-
Notifications
You must be signed in to change notification settings - Fork 0
/
addProduct.php
55 lines (39 loc) · 1.17 KB
/
addProduct.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
<?php
include_once 'includes/dbHandler.php';
?>
<!DOCTYPE html>
<html>
<body>
<h1>Add new product</h1>
<form action = "includes/addProd.php" method = "POST">
<input type="text" name="product" placeholder="Product"><br><br>
<input type="text" name="price" placeholder="Price"><br><br>
<input type="text" name="amount" placeholder="Amount"><br><br>
<input type="text" name="category" placeholder="Category"><br><br>
<button type="submit" value="Submit"> Submit </button>
</form>
<h1>Remove product</h1>
<form action = "includes/removeProd.php" method = "POST">
<input type="text" name="productID" placeholder="ProductID"><br><br>
<button type="submit" value="Submit"> Submit </button>
</form>
<b>
<p>
<?php
$sql = "SELECT * FROM products;";
$result = mysqli_query($conn, $sql);
$checkResult = mysqli_num_rows($result);
if($checkResult > 0){
while($row = mysqli_fetch_assoc($result)){
echo "<br>" . "ID: " . $row['idProduct'] . "<br>";
echo "Name: " . $row['p_name'] . "<br>";
echo "Category: " . $row['category'] . "<br>";
echo "Price: " . $row['price'] . "<br>";
echo "Stock: " . $row['stock'] . "<br>";
}
}
?>
</p>
</b>
</body>
</html>