-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.php
48 lines (40 loc) · 1.57 KB
/
admin.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
< <link rel="stylesheet" href="admin.css">
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="text" name="productName" placeholder="Product Name">
<?php
include('conn.php');
$sql = "SELECT cat_name FROM categories WHERE status='active'";
$result = $conn->query($sql);
$categories = [];
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$categories[] = $row;
}
}
$conn->close();
?>
<div class="category-dropdown">
<label for="category">Category</label>
<select name="category" id="category" required>
<option value="" disabled selected>Select a category</option>
<?php foreach ($categories as $category) : ?>
<option value="<?php echo $category['cat_name']; ?>"><?php echo $category['cat_name']; ?></option>
<?php endforeach; ?>
</select>
</div>
<input type="file" name="image" id="image" accept="image/*" required>
<input type="text" name="description" placeholder="Product Description">
<input type="text" name="stock" placeholder="In Stock">
<input type="text" name="price" placeholder="Price">
<input type="submit" value="Submit" name="submit">
</form>
</body>
</html>