-
Notifications
You must be signed in to change notification settings - Fork 0
/
extra codes.php
166 lines (129 loc) · 7.1 KB
/
extra codes.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
$(document).ready(function() {
$(document).on('click','.editbtn', function(){
var r_id = $(this).attr("r_id");
$.ajax({
url:'product.php',
method:'POST',
dataType : 'json',
contentType : 'application/json',
data : JSON.stringify({
call : 4,
id : r_id,
}),
success: function(data){
$('#title').val(data.name);
$('#ing').val(data.ing);
$('#steps').val(data.steps);
$('#desc').val(data.desc);
$('#cat').val(data.cat);
$('#serv').val(data.serv);
$('#time').val(data.time);
$('#img').val(data.img);
$('#edit_btn').val(data.r_id);
$('#insert').val("update");
$('#editmodal').modal('show');
}
});
});
});
<div class="modal fade" id="editmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Edit Recipe</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form action="editform.php"> <!--form ID=addRecipe-->
<div class="modal-body">
<div class="form-row">
<div class="col-md-12">
<h5>Title :</h5>
</div>
</div>
<div class="form-row py-1">
<div class="form-group col-md-12">
<input name="title" autocomplete="off" type="text" id="title" class="form-control" placeholder="Title" required>
</div>
</div>
<!-- ADD INGREDIANTS -->
<div id="ingrediants_field"> <!--id=ingrediants_field-->
<div class="form-row">
<div class="col-md-12">
<h5>Ingrediants :</h5>
</div>
</div>
<div class="form-row">
<div class="col-md-10 form-group text-center">
<input type="text" class="form-control" autocomplete="off" id="ing" placeholder="Ingrediants" name="ingrediants[]" required/> <!--name=ingrediants[]-->
</div>
</div>
</div>
<!-- ADD METHOD STEPS -->
<div id="steps_field"> <!--id=steps_field-->
<div class="form-row">
<div class="col-md-12">
<h5>Method :</h5>
</div>
</div>
<div class="form-row">
<div class="col-md-10 form-group text-center">
<input type="text" class="form-control" autocomplete="off" id="steps" placeholder="Write step" name="steps[]" required/> <!--name=steps[]-->
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-12">
<h5>Description :</h5>
</div>
</div>
<div class="form-row py-1">
<div class="form-group col-md-12">
<input name="description" autocomplete="off" id="desc" type="text"class="form-control" placeholder="Add description" required>
</div>
</div>
<div class="form-row pb-3">
<div class="col-md-4">
<h5>Category :</h5>
<select name="category" class="form-control" id="cat">
<option value="1">Vegetarian</option>
<option value="2">Vegan</option>
<option value="3">Lacto Veg</option>
<option value="4">Ovo Veg</option>
</select>
</div>
<div class="col-md-4">
<h5>Servings :</h5>
<input name="servings" autocomplete="off" id="serv" type="text" class="form-control" placeholder="Add servings" required>
</div>
<div class="col-md-4">
<h5>Time :</h5>
<input name="timing" autocomplete="off" id="time" type="text" class="form-control" placeholder="Add timing" required>
</div>
</div>
<div id="images_field">
<div class="form-row">
<div class="col-md-12">
<h5>Add image :</h5>
</div>
</div>
<div class="form-row">
<div class="col-md-12 form-group text-center">
<div class="custom-file">
<input type="file" id="img" class="custom-file-input" name="image" required>
<label class="custom-file-label" for="pimage">Upload Image</label>
</div>
</div>
</div>
</div>
<input type="hidden" name="edit_btn" id="edit_btn">
<div class="modal-footer">
<button type="button" class="btn btn-info" data-dismiss="modal">Close</button>
<button type="button" name="insertdata" id="insert" class="btn btn-primary" data-dismiss="modal">Update</button>
</div>
</div>
</form>
</div>
</div>
</div>