D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
u384067285
/
domains
/
cauldronsisterss.com
/
public_html
/
admin
/
Filename :
categories.php
back
Copy
<?php session_start(); error_reporting(0); include 'connection.php'; if (strlen($_SESSION['bpmsaid'] == 0)) { header("Location: logout.php"); } if (isset($_POST['add'])) { /* Fetch Requests from input box */ $category_name = $_POST['category_name']; /* Add Requests */ $sql = "INSERT INTO tblcategories (category_name) VALUES ('$category_name')"; if ($conn->query($sql) === TRUE) { $msg = "Category Added Successfully"; } else { $msg = $conn->error; } } ?> <!DOCTYPE html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Cauldron Sisterss | Categories</title> <!-- plugins:css --> <link rel="stylesheet" href="vendors/feather/feather.css"> <link rel="stylesheet" href="vendors/mdi/css/materialdesignicons.min.css"> <link rel="stylesheet" href="vendors/ti-icons/css/themify-icons.css"> <link rel="stylesheet" href="vendors/typicons/typicons.css"> <link rel="stylesheet" href="vendors/simple-line-icons/css/simple-line-icons.css"> <link rel="stylesheet" href="vendors/css/vendor.bundle.base.css"> <!-- endinject --> <!-- Plugin css for this page --> <link rel="stylesheet" href="vendors/select2/select2.min.css"> <link rel="stylesheet" href="vendors/select2-bootstrap-theme/select2-bootstrap.min.css"> <!-- End plugin css for this page --> <!-- inject:css --> <link rel="stylesheet" href="css/vertical-layout-light/style.css"> <!-- endinject --> <?php include 'favicon.php'; ?> </head> <body> <div class="container-scroller"> <!-- partial:../../partials/_navbar.php --> <?php include 'header.php'; ?> <!-- partial --> <div class="container-fluid page-body-wrapper"> <!-- partial:../../partials/_sidebar.html --> <?php include 'sidebar.php'; ?> <!-- partial --> <div class="main-panel"> <div class="content-wrapper"> <div class="row"> <div class="col-md-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <h4 class="card-title">Add Category <span style = "color:red;"> <?php echo $msg; ?> </span> </h4> <form class="forms-sample" method="post"> <div class="form-group"> <label for="category">Category Name</label> <input type="text" class="form-control" id="category" placeholder="Category" name="category_name" required> </div> <button type="submit" class="btn btn-primary me-2" name="add">Add</button> </form> </div> </div> </div> </div> <!-- Manage Categories --> <div class="row"> <div class="col-lg-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <h4 class="card-title">Manage Category </h4> <div class="table-responsive"> <table class="table table-hover"> <thead> <tr> <th>#</th> <th>Category Name</th> <th>Action</th> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM tblcategories"; $result = $conn->query($sql); $cnt = 1; while ($row = mysqli_fetch_array($result)) { ?> <tr> <td><?php echo $cnt; ?></td> <td><?php echo $row['category_name']; ?></td> <td> <label class="badge badge-warning"> <a href = "edit_category.php?editid=<?php echo $row['category_name']; ?>" style="text-decoration:none; color:black;">Edit</a> </label> <label class="badge badge-danger"> <a href = "delete_category.php?id=<?php echo $row['category_name']; ?>" style="text-decoration:none; color:black;">Delete</a> </label> </td> </tr> <?php $cnt = $cnt + 1; } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> <!-- content-wrapper ends --> <!-- partial:../../partials/_footer.html --> <?php include 'footer.php'; ?> <!-- partial --> </div> <!-- main-panel ends --> </div> <!-- page-body-wrapper ends --> </div> <!-- container-scroller --> <!-- plugins:js --> <script src="vendors/js/vendor.bundle.base.js"></script> <!-- endinject --> <!-- Plugin js for this page --> <script src="vendors/typeahead.js/typeahead.bundle.min.js"></script> <script src="vendors/select2/select2.min.js"></script> <script src="vendors/bootstrap-datepicker/bootstrap-datepicker.min.js"></script> <!-- End plugin js for this page --> <!-- inject:js --> <script src="js/off-canvas.js"></script> <script src="js/hoverable-collapse.js"></script> <script src="js/template.js"></script> <script src="js/settings.js"></script> <script src="js/todolist.js"></script> <!-- endinject --> <!-- Custom js for this page--> <script src="js/file-upload.js"></script> <script src="js/typeahead.js"></script> <script src="js/select2.js"></script> <!-- End custom js for this page--> </body> </html>