-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtable.php
More file actions
89 lines (85 loc) · 3.69 KB
/
Copy pathtable.php
File metadata and controls
89 lines (85 loc) · 3.69 KB
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Inventory Management System</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="./assets/images/fav.png" type="image/x-icon">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
</head>
<body>
<div class="container-fluid mb-4 text-center shadow-lg p-3 mb-3 bg-body rounded">
<img src="./assets/images/logo2.png" class="img-fluid" alt="">
</div>
<div class="container">
<h2 class="text-center">Add Item Here</h2>
<body>
<form method="POST" class="form-inline" action="additem.php">
<div class="form-group ms-3 mt-3">
<label for="name">Product Name</label>
<input type="text" class="form-control" name="product_name">
</div>
<div class="form-group ms-3 mt-3">
<label for="name">Price</label>
<input type="text" class="form-control" name="price">
</div>
<div class="form-group ms-3 mt-3">
<label for="name">Quantity</label>
<input type="number" class="form-control" name="quant" id="quant" min="1" max="">
</div>
<button type="submit" class="btn btn-primary ms-3 mt-3" name="add">Add item</button>
</form>
</body>
<div class="container-fluid mt-4">
<table class="table text-dark text-center table-striped table-hover table-bordered">
<thead class="text-uppercase">
<tr class="table-active table-primary">
<th scope="col">ID</th>
<th scope="col">Name</th>
<th scope="col">Price</th>
<th scope="col">Quantity</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<?php
$conn = new mysqli("localhost", "root", "", "inventorymanagement");
$sql = "SELECT * FROM product";
$result = $conn->query($sql);
$count = 0;
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc())
{
$count = $count + 1;
?>
<tr>
<th>
<?php echo $count ?>
</th>
<th>
<?php echo $row["product_name"] ?>
</th>
<th>
<?php echo $row["price"] ?>
</th>
<th>
<?php echo $row["quantity"] ?>
</th>
<th>
<a href="up" Edit</a><a href="edit.php?id=<?php echo $row["product_id"] ?>">Edit</a>
<a href="up" Edit</a><a href="delete.php?id=<?php echo $row["product_id"] ?>">Delete</a>
</th>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</body>
</html>