<div class="left_content"> <?php include 'categoriesBox.php'; include 'login.php'; include 'specialProductsBox.php'; ?> </div><!-- end of left content --> <div class="center_content"> <div class="center_title_bar">Search result</div> <?php include "../../classes/subcategory.php"; $subcat = new Subcategory(); $id = $_GET['id']; $data = $subcat->getSubcategories($id); if (empty($data)) { echo "<h2 style='margin-top:70px;margin-left:200px;'> No result to show </h2>"; } foreach ($data as $key => $row) { foreach ($row as $key => $value) { $name = $row["scName"]; $id = $row["scID"]; } echo "<div class='container' style='font-size:15px; width:500px;'>"; echo "<table class='table table-hover'>"; echo "<tr>"; //echo "<th>"; echo "<th> <a href='showprod.php?id={$id}'> {$name} </a></th>"; //echo "</th>"; echo "</tr>";
<form method="post" action=""> <fieldset> <legend>DELETE</legend> <table class='table table-hover'> <tr> <thead> <th>Category</th> <th>Subcategory</th> <th>Action</th> </thead> </tr> <?php include '../../classes/subcategory.php'; $subcategory = new Subcategory(); foreach ($cData as $key => $cate) { $scData = $subcategory->getSubcategories($cate['cID']); $scCount = count($scData); echo "<tr>"; echo "<td class='cNameCol' value='" . $cate['cID'] . "' rowspan='" . $scCount . "'>" . $cate['cName'] . "</td>"; if ($scCount == 0) { echo "<td colspan='2'> --------- This Category is EMPTY --------- </td>"; echo "</tr>"; } else { echo "<td class='scNameCol'>" . $scData[0]['scName'] . "</td>"; echo "<td class='actCol danger'><a href='' class='deleteSC' value='" . $scData[0]['scID'] . "'>delete</a></td>"; echo "</tr>"; // echo "</section>"; // echo "</tbody>"; } for ($i = $scCount - 1; $i > 0; $i--) { echo "<tr>";
if (isset($_GET['catID']) && isset($_GET['scatID']) && isset($_GET['newName'])) { if (!empty($_GET['catID']) && !empty($_GET['scatID']) && !empty($_GET['newName'])) { $subcategory = new Subcategory(); $subcategory->cID = $_GET['catID']; $subcategory->scID = $_GET['scatID']; $subcategory->scName = $_GET['newName']; $subcategory->update(); $responce = 'done'; } else { $responce = 'all data are required'; } } //-------------------------------- get subcategories of a specific category -------------------------------- if (isset($_GET['selected_cID'])) { if (!empty($_GET['selected_cID'])) { $subcategory = new Subcategory(); $responce = $subcategory->getSubcategories($_GET['selected_cID']); $responce = json_encode($responce); } } //-------------------------------------------- draw table ---------------------------------------------- if (isset($_GET['op'])) { if (!empty($_GET['op'])) { if ($_GET['op'] == 'drawTable') { $subcategory = new Subcategory(); $data = $subcategory->getCorrespondingCat(); $responce = json_encode($data); } } } echo $responce;