-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew_product.php
69 lines (67 loc) · 2.15 KB
/
new_product.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
$page_title = "New Product";
require 'header.php';
?>
<div class="page-header">
<h1>New Product</h1>
</div>
<form class="form-horizontal" action="#" id="product_insert">
<div class="control-group">
<label class="control-label" for="inputProductName">Product Name</label>
<div class="controls">
<input type="text" class="input tp" name="inputProductName" id="inputProductName" placeholder="Product Name">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputProductGroup">Product Group</label>
<div class="controls">
<input type="text" class="input tp" name="inputProductGroup" id="inputProductGroup" placeholder="Product Group">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputProductVendor">Product Vendor</label>
<div class="controls">
<input type="text" class="input tp" name="inputProductVendor" id="inputProductVendor" placeholder="Product Vendor">
</div>
</div>
<div class="form-actions">
<div class="controls submit">
<button type="submit" class="btn btn-primary loadingbtn" id="submitbutton">Create Product</button>
</div>
</div>
</form>
<?php
$script = "
<script type='text/javascript'>
$('#product_insert').validate({
rules: {
inputProductName: {required: true, maxlength: 255},
inputProductGroup: {required: true, maxlength: 255},
inputProductVendor: {required: true, maxlength: 255},
},
highlight: function(label) {
$(label).closest('.control-group').addClass('error');
},
success: function(label) {
label
.addClass('valid')
.closest('.control-group').addClass('success');
},
submitHandler: function(form) {
$('.loadingbtn').button('loading');
productcreatefunct();
}
});
function productcreatefunct() {
$.ajax({
type: \"POST\",
url: \"scripts/product_insert.php\",
data: {inputProductName: document.getElementById(\"inputProductName\").value, inputProductGroup: document.getElementById(\"inputProductGroup\").value, inputProductVendor: document.getElementById(\"inputProductVendor\").value},
success: function(response){
$('#product_insert').html(response)
}
});
}
</script>";
require 'footer.php';
?>