-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable.php
273 lines (221 loc) · 10.2 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<?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">
<!-- amchart css -->
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
<!-- others css -->
<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">
<!-- modernizr css -->
<script src="assets/js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!-- preloader area start -->
<div id="preloader">
<div class="loader"></div>
</div>
<!-- preloader area end -->
<!-- page container area start -->
<div class="page-container">
<!-- sidebar menu area start -->
<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>
<!-- sidebar menu area end -->
<!-- main content area start -->
<div class="main-content">
<!-- header area start -->
<div class="header-area">
<div class="row align-items-center">
<!-- nav and search button -->
<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>
<!-- profile info & task notification-->
<div class="col-md-6 col-sm-4 clearfix">
</div>
</div>
</div>
<!-- header area end -->
<!-- page title area start -->
<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>
<!-- page title area end -->
<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">
<!-- Contextual Classes start -->
<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","","inventory");
$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>
<!-- Contextual Classes end -->
<!-- main content area end -->
<html>
<head>
<title>Add Item</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
</head>
</html>
</div>
<!-- page container area end -->
<!-- offset area start -->
<!-- offset area end -->
<!-- jquery latest version -->
<script src="assets/js/vendor/jquery-2.2.4.min.js"></script>
<!-- bootstrap 4 js -->
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/owl.carousel.min.js"></script>
<script src="assets/js/metisMenu.min.js"></script>
<script src="assets/js/jquery.slimscroll.min.js"></script>
<script src="assets/js/jquery.slicknav.min.js"></script>
<!-- others plugins -->
<script src="assets/js/plugins.js"></script>
<script src="assets/js/scripts.js"></script>
</body>
<footer>
<div class="footer-area">
<p>© Copyright E-Inventory. All right reserved.</p>
</div>
</footer>
</html>