JezK
Edit File: classnsection_manage.php
<?php session_start(); include("session_check.php"); include("adm_operations.php"); include("header.php"); $operations = new adm_operations(); include('school_timeout.php'); //print_r($SESSION); if (isset($_GET['cls_ref']) && $_GET['act'] = 'del') { $delete = $operations->deletethisClass($_SESSION['child']['log_school_id'], $_GET['cls_ref'], $_SESSION['child']['choosen_academic_id']); if ($delete == 'success') { echo "<script>location.replace('classnsection_manage.php')</script>"; } else if ($delete == '101') { echo "<script>alert('You can not delete the Junior Most Class')</script>"; echo "<script>location.replace('classnsection_manage.php')</script>"; } else if ($delete == 'fail') { echo "<script>alert('You can not delete the Class as some data is associated with it')</script>"; echo "<script>location.replace('classnsection_manage.php')</script>"; } else if ($delete == 'notlast') echo "<script>alert('You can not delete a class from the middle of the hierarchy')</script>"; } $classes = $operations->getallpreviousClasses($_SESSION['child']['log_school_id'], $_SESSION['child']['choosen_academic_id']); ?> <style> .table-condensed>thead>tr>th, .table-condensed>tbody>tr>th, .table-condensed>tfoot>tr>th, .table-condensed>thead>tr>td, .table-condensed>tbody>tr>td, .table-condensed>tfoot>tr>td { padding: 3px; } select { width: 62px !important; background-color: #FFF; border: 1px solid #CCC; } </style> <body style="overflow-x: hidden;"> <div class="row" style="margin-top: 30px;margin-left:20px;"> <div class="col-md-9 text-start" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:24px;"> <i class="fa-solid fa-folder-open" title=" Class & Section Management" style="font-size: 20px;margin: 0px 0px 0px -15px;"> </i> Class & Section Management </div> <div class="col-md-3 text-center"> <button type="button" onClick="location.href='addclass_and_section.php'" class="btn btn-outline-secondary" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;">Add Class & Section</button> </div> </div> <div class="row" style="margin-left:10px;margin-right:10px;"> <div class="col-md-12 centered" style="font-family: Arial, Helvetica, sans-serif;margin-top:30px;"> <table id="myTable" class="table table-condensed table-hover" style="margin-top:-10px;"> <thead> <tr class="info"> <th class="col-md-1 text-center">Sl.No</th> <th>Category</th> <th>Class Name</th> <th>Sections</th> <th>Actions</th> </tr> </thead> <tbody> <?php if ($classes != 0) { $j = 1; foreach ($classes as $row) { echo '<tr> <td class="col-sm-1 text-center" style=" font-size:14px;">' . $j . '</td> <td style=" font-size:14px;">' . ucfirst($row['cat_name']) . '</td> <td style=" font-size:14px;">' . $row['class_name'] . '</td> <td style="font-size:14px;"> ' . substr($row['sections'], 0, 20) . '..</td> <td class="center"> <a class=" buttonn" href="editclass_and_section.php?cls_ref=' . $row['class_id'] . '" style="margin:4px;text-decoration:none"> <i class="fa-solid fa-pencil" title ="Edit" style="font-size: 14px; color:#01aee6;"></i> </a> <a class=" buttonn" href="classnsection_manage.php?cls_ref=' . $row['class_id'] . '&act=del" style="margin:4px;text-decoration:none" onclick="return confirm(\'Do you want to Delete this Class ?\');"> <i class=" fa-solid fa-xmark" title="Delete" style="font-size: 14px; color:#01aee6;text-shadow: 0px 0px 0 #01aee6, 1px 0px 0 #01aee6, 0px 1px 0 #01aee6, 0px 0px 0 #01aee6;"></i> </a> </td> </tr>'; $j++; } } ?> </tbody> </table> </div> </div> <script src="//code.jquery.com/jquery-1.12.0.min.js"></script> <script src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/buttons/1.1.2/js/dataTables.buttons.min.js"></script> <script src="//cdn.datatables.net/buttons/1.1.2/js/buttons.print.min.js"></script> <script src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script> <script src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script> <script src="//cdn.datatables.net/buttons/1.1.2/js/buttons.html5.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script> <script> $(document).ready(function() { /* $('#myTable').DataTable({ "pageLength":100, stateSave: true, dom: 'T<"clear">lfrtip', "oLanguage": { "sSearch": "" }, tableTools: { "aButtons": [ { "sExtends": "xls", "mColumns": [0, 1, 2, 3] }, { "sExtends": "pdf", "sPdfOrientation": "landscape", "mColumns": [0, 1, 2, 3] }, { "sExtends": "print", "mColumns": [0, 1, 2, 3] } ] } }); $('div.dataTables_filter input').attr('placeholder', 'Search'); */ $('#myTable').DataTable({ dom: 'B<"clear">lfrtip', "iDisplayLength": 100, stateSave: true, buttons: [{ extend: 'print', title: '<center><h3><?php echo $_SESSION['child']['school_name'] ?></h3></center>', message: 'Class and Section Management<br>Academic Year:<?php echo $_SESSION['child']['choosen_year_name'] ?><br>', exportOptions: { columns: [0, 1, 2, 3] } }, { extend: 'pdfHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', message: 'Class and Section Management\nAcademic Year:<?php echo $_SESSION['child']['choosen_year_name'] ?>\n', exportOptions: { columns: [0, 1, 2, 3] } }, { extend: 'excelHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', exportOptions: { columns: [0, 1, 2, 3] } } ] }); }); </script>