-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.php
183 lines (168 loc) · 7.58 KB
/
table.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
<?php
session_start();
if (!isset($_SESSION['username'])) {
$_SESSION['msg'] = "You must log in first";
header('location: login.php');
}
if (isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['username']);
header("location: login.php");
}
?>
<!doctype html>
<html class="no-js" lang="en">
<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" type="image/png" href="assets/images/icon/favicon.ico">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/css/themify-icons.css">
<link rel="stylesheet" href="assets/css/metisMenu.css">
<link rel="stylesheet" href="assets/css/owl.carousel.min.css">
<link rel="stylesheet" href="assets/css/slicknav.min.css">
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
<link rel="stylesheet" href="assets/css/typography.css">
<link rel="stylesheet" href="assets/css/default-css.css">
<link rel="stylesheet" href="assets/css/styles.css">
<link rel="stylesheet" href="assets/css/responsive.css">
<script src="assets/js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
<div class="page-container">
<div class="sidebar-menu">
<div class="sidebar-header">
<div class="logo">
<a href="index.php"><img src="assets/images/icon/logo.png" alt="logo"></a>
</div>
</div>
<div class="main-menu">
<div class="menu-inner">
<nav>
<ul class="metismenu" id="menu">
<li>
<a href="index.php" aria-expanded="true"><i class="ti-dashboard"></i><span>dashboard</span></a>
</li>
<li class="active">
<a href="table.php" aria-expanded="true"><i class="fa fa-table"></i>
<span>Item Records</span></a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="main-content">
<div class="header-area">
<div class="row align-items-center">
<div class="col-md-6 col-sm-8 clearfix">
<div class="nav-btn pull-left">
<span></span>
<span></span>
<span></span>
</div>
<div class="search-box pull-left">
<form action="#">
<input type="text" name="search" placeholder="Search..." required>
<i class="ti-search"></i>
</form>
</div>
</div>
<div class="col-md-6 col-sm-4 clearfix">
</div>
</div>
</div>
<div class="page-title-area">
<div class="row align-items-center">
<div class="col-sm-6">
<div class="breadcrumbs-area clearfix">
<h4 class="page-title pull-left">Dashboard</h4>
<ul class="breadcrumbs pull-left">
<li><a href="index.php">Home</a></li>
<li><span>Item Records</span></li>
</ul>
</div>
</div>
<div class="col-sm-6 clearfix">
<div class="user-profile pull-right">
<img class="avatar user-thumb" src="assets/images/author/avatar.png" alt="avatar">
<h4 class="user-name dropdown-toggle" data-toggle="dropdown"><?php echo $_SESSION['username']; ?> <i class="fa fa-angle-down"></i></h4>
<div class="dropdown-menu">
<a class="dropdown-item" href="index.php?logout='1'">Log Out</a>
</div>
</div>
</div>
</div>
</div>
<div>
<h1 style="text-align:center">Add Item Here</h1>
<body>
<form method="POST" class="form-inline" action="additem.php">
<div class="form-group">
<label for="name">Product Name</label>
<input type="text" class="form-control" name="product_name">
</div>
<div class="form-group">
<label for="name">Price</label>
<input type="text" class="form-control" name="price">
</div>
<div class="form-group">
<label for="name">Quantity</label>
<input type="number" name="quant" id="quant" min="1" max="">
</div>
<button type="submit" class="btn btn-default" name="add">Add item</button>
</form>
</body>
<div class="main-content-inner">
<div class="row">
<div class="col-lg-6 mt-5">
<div class="card">
<div class="card-body">
<h4 class="header-title">Products</h4>
<div class="single-table">
<div class="table-responsive">
<table class="table text-dark text-center">
<thead class="text-uppercase">
<tr class="table-active">
<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>
</div>
</div>
<div>
</div>
</div>
</html>