-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditproduct.php
199 lines (192 loc) · 8.79 KB
/
editproduct.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<?php
include 'headerfiles.html';
?>
</head>
<body>
<?php
include_once 'adminheader.php';
$productid = $_REQUEST['productid'];
$query = "SELECT * FROM `product` INNER join subcategory on product.subcatid = subcategory.subcategoryid where productid ='$productid'";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_array($result);
?>
<div class="container">
<form action="updateproduct.php" id="form1" method="post" enctype="multipart/form-data">
<div class="row text-primary justify-content-center mb-4 mt-3">
<h1>Edit Product</h1>
</div>
<div class="row input-container">
<div class="col-sm-6">
<div class="row">
<div class="col-sm-4">
<label for="category" class="">Category</label>
</div>
<div class="col-sm-8">
<select name="category" class="input-field" id="category" onchange="showsubcat(this.value)">
<option value="">Select Category</option>
<?php
$qury = "select categoryname from category";
$res = mysqli_query($conn, $qury);
while ($category = mysqli_fetch_assoc($res)) {
?>
<option value="<?php echo $category["categoryname"]; ?>"
<?php if (($row['category']) == $category['categoryname']) { ?>selected<?php } ?>><?php echo $category["categoryname"]; ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="col-sm-6" id="subcat">
<div class="row">
<div class="col-sm-4">
<label for="subcategory" class="">Sub Category</label>
</div>
<div class="col-sm-8">
<select name="subcategory" class="input-field" id="subcategory">
<option value="">Select Sub Category</option>
<?php
$qury = "select * from subcategory";
$res = mysqli_query($conn, $qury);
while ($category = mysqli_fetch_assoc($res)) {
?>
<option value="<?php echo $category["subcategoryid"]; ?>"
<?php if ($row['subcatid'] == $category['subcategoryid']) { ?>selected<?php } ?>><?php echo $category["subcategoryname"]; ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
</div>
<div class="row input-container">
<!-- <div class="col-sm-6">-->
<!-- <div class="row">-->
<!-- <div class="col-sm-4">-->
<!-- <label for="subcategory" class="">Sub Category</label>-->
<!---->
<!-- </div>-->
<!-- <div class="col-sm-8">-->
<!-- <select name="subcategory" class="input-field" id="subcategory">-->
<!-- <option value="">Select Sub Category</option>-->
<!-- <option value="">--><?php //?><!--</option>-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<!---->
<!-- </div>-->
</div>
<div class="row input-container">
<div class="col-sm-6">
<div class="row">
<div class="col-sm-4">
<label for="productname" class="">Product Name</label>
</div>
<div class="col-sm-8">
<input type="text" data-rule-required="true" value="<?php echo $row[1]; ?>" class="input-field"
name="productname" id="productname">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="row">
<div class="col-sm-6">
<label for="photo">Photo</label>
</div>
<div class="col-sm-6">
<input type="file" class="input-field" name="photo" id="photo">
</div>
</div>
</div>
</div>
<div class="row input-container">
<div class="col-sm-4">
<div class="row">
<div class="col-sm-4">
<label for="price" data-rule-required="true" class="">Price</label>
</div>
<div class="col-sm-8">
<input type="number" data-rule-required="true" class="input-field"
value="<?php echo $row[2]; ?>" name="price" id="price">
</div>
</div>
</div>
<div class="col-sm-4">
<div class="row">
<div class="col-sm-4">
<label for="stock">Stock</label>
</div>
<div class="col-sm-8">
<input type="number" data-rule-required="true" class="input-field" value="<?php echo $row[3]; ?>" name="stock" id="stock">
</div>
</div>
</div>
<div class="col-sm-4">
<div class="row">
<div class="col-sm-4">
<label for="discount">Discount</label>
</div>
<div class="col-sm-8">
<input type="number" data-rule-required="true" class="input-field" value="<?php echo $row[4]; ?>" name="discount" id="discount">
</div>
</div>
</div>
<!-- <div class="col-sm-6">-->
<!-- <div class="row">-->
<!-- <div class="col-sm-4">-->
<!-- <label for="price" data-rule-required="true" class="">Price</label>-->
<!-- </div>-->
<!-- <div class="col-sm-8">-->
<!-- <input type="number" data-rule-required="true" class="input-field" value="-->
<?php //echo $row[2]; ?><!--" name="price" id="price">-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="col-sm-6">-->
<!-- <div class="row">-->
<!-- <div class="col-sm-4">-->
<!-- <label for="stock">Stock</label>-->
<!-- </div>-->
<!-- <div class="col-sm-8">-->
<!-- <input type="number" data-rule-required="true" class="input-field" value="-->
<?php //echo $row[3]; ?><!--" name="stock" id="stock">-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>
<div class="row input-container">
<div class="col-sm-2">
<label for="description" class="">Description</label>
</div>
<div class="col-sm-6">
<textarea name="description" data-rule-required="true" id="description" class="input-field" cols="50"
rows="5"><?php echo $row[6]; ?></textarea>
</div>
<div class="col-sm-4">
<img style="height: 100px;width: 100px" src="<?php echo $row[5]; ?>" alt="">
</div>
</div>
<div class="row input-container">
<div class="col-sm-8 offset-2">
<input type="hidden" name="productid" data-rule-required="true" value="<?php echo $row[0]; ?>">
<input type="submit" class="btn btn-primary">
</div>
</div>
</form>
<?php
include_once 'footer.php';
?>
</div>
</body>
</html>
<?php