File "manage-category.php"
Full Path: /home/quiczmwg/lightspringdigitals.com/admin/manage-category.php
File size: 5.45 KB
MIME-type: text/x-php
Charset: utf-8
<?php
include 'head.php';
include 'header.php';
?>
<body class="skin-default fixed-layout">
<div id="main-wrapper">
<?php
include 'sidebar.php';
if (isset($message)) {
foreach ($message as $message) {
echo '<div class="message"><span>' . $message . '</span> <i class="fas fa-times" onclick="this. parentElement.style.display = `none`;"></i> </div>';
};
};
?>
<div class="page-wrapper">
<div class="container-fluid">
<?php include 'nav.php'; ?>
<div class="container">
<div class="container">
<div class="text-right my-3">
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#myModal">
<i class="bi bi-plus"></i>Add Category
</button>
</div>
</div>
<!-- The Modal -->
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Manage Category</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<form action="manage-category-process.php" method="post" class="add-product-form" enctype="multipart/form-data">
<div class="form-group">
<input type="text" name="category" placeholder="Enter category name" class="form-control my-2 " required>
</div>
<div class="form-group">
<input type="file" name="category_image" accept="image/png, image/jpeg, image/jpg" class="form-control my-2 " required>
</div>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<!-- <button type="submit" name="btnSave" class="btn btn-success bg-warn">Submit</button> -->
<button type="submit" name="add_category" class="btn btn-success bg-warn">Submit</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
<section>
<div class="d-flex justify-content-end align-items-center">
<div class="container-fluid">
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="table">
<thead>
<th>#</th>
<th>Category Image</th>
<th>Category Name</th>
<th>Action</th>
<!-- <th>----</th> -->
</thead><br>
<?php
$select_category = mysqli_query($conn, "SELECT * FROM `category` ");
if (mysqli_num_rows($select_category) > 0) {
$num=1;
while ($row = mysqli_fetch_assoc($select_category)){
?>
<tbody>
<tr>
<td><?php echo $num++; ?></td>
<td><img src="../category/<?php echo $row['category_image']; ?>" height="100" alt=""></td>
<td><?php echo html_entity_decode($row['category']); ?></td>
<td>
<a href="delete-category.php?delete=<?php echo $row['id']; ?>" class="btn btn-danger" onclick="return confirm('are you sure you want to delete this?');"><i class="bi bi-trash3-fill"></i></a>
<?php } }?>
<!-- </form> -->
</div>
</div>
</div>
</td><br>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
<?php
include 'footer.php';
?>