-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewCategories.php
76 lines (67 loc) · 2.36 KB
/
viewCategories.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
<div >
<h3>Category Items</h3>
<table class="table ">
<thead>
<tr>
<th class="text-center">S.N.</th>
<th class="text-center">Category Name</th>
<th class="text-center">Description</th>
<th class="text-center" colspan="2">Action</th>
</tr>
</thead>
<?php
include_once "./dbconnect.php";
$sql="SELECT * from category";
$result=$conn-> query($sql);
$count=1;
if ($result-> num_rows > 0){
while ($row=$result-> fetch_assoc()) {
?>
<tr>
<td><?=$count?></td>
<td><?=$row["cat_title"]?></td>
<td><?=$row["cat_desc"]?></td>
<!-- <td><button class="btn btn-primary" >Edit</button></td> -->
<td><button class="btn btn-danger" style="height:40px" onclick="categoryDelete('<?=$row['cat_id']?>')">Delete</button></td>
</tr>
<?php
$count=$count+1;
}
}
?>
</table>
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-secondary" style="height:40px" data-toggle="modal" data-target="#myModal">
Add Category
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">New Category Item</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<form enctype='multipart/form-data' action="./addCatController.php" method="POST">
<div class="form-group">
<label for="c_name">Category Name:</label>
<input type="text" class="form-control" name="c_name" required>
</div>
<div class="form-group">
<label for="c_desc">Description:</label>
<input type="text" class="form-control" name="c_desc" required>
</div>
<div class="form-group">
<button type="submit" class="btn btn-secondary" name="upload" style="height:40px">Add Category</button>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" style="height:40px">Close</button>
</div>
</div>
</div>
</div>
</div>