-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmanageCat.php
More file actions
90 lines (79 loc) · 2.69 KB
/
manageCat.php
File metadata and controls
90 lines (79 loc) · 2.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
90
<?php include 'include/head.php';?>
<?php include 'include/nav.php';?>
<?php
$notice="";
if (isset($_POST['safeIn']))
{
$filename = $_FILES['inPic']['name'];
move_uploaded_file($_FILES["inPic"]["tmp_name"], "photo/".$_FILES["inPic"]["name"]);
if ($con->query("insert into categories (name,pic) value ('$_POST[inName]','$filename')")) {
$notice ="<div class='alert alert-success'>Successfully Saved</div>";
}
else
$notice ="<div class='alert alert-danger'>Not saved Error:".$con->error."</div>";
}
?>
<?php echo $notice; ?>
<div class="container">
Group
<button class="btn btn-primary btn-sm pull-right" data-toggle="modal" data-target="#addIn"><i class="icon icon-plus"></i> New Group</button>
<br/><br/>
<?php
$i=0;
$array = $con->query("select * from categories");
?>
<br>
<table class="table table-striped table-hover">
<tr>
<th>#</th>
<th>Name</th>
<th>Products</th>
<th>Set</th>
</tr>
<?php
while ($row = $array->fetch_assoc())
{
$i++;
$array2 = $con->query("select count(*) as qty from inventeries where catId = '$row[id]'");
$row2 = $array2->fetch_assoc();
?>
<tr>
<td><?php echo $i ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row2['qty']; ?></td>
<td><a href="delete.php?category=<?php echo $row['id'] ?>"><button class="btn btn-primary">Delete</button></a></td>
</tr>
<?php
}
echo "</table>";
?>
</div>
<div id="addIn" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">New Group</h4>
</div>
<div class="modal-body"> <form method="POST" enctype="multipart/form-data">
<div style="width: 77%;margin: auto;">
<div class="form-group">
<label for="some" class="col-form-label">Group Name</label>
<input type="text" name="inName" class="form-control" id="some" required>
</div>
<div class="form-group">
<label for="2" class="col-form-label">Cover Image</label>
<input type="file" name="inPic" class="form-control" id="2" required>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" name="safeIn">Save Group</button>
</div>
</form>
</div>
</div>
</div>
<?php include 'include/footer.php';?>