JezK
Edit File: route_management.php
<?php //~ ini_set('display_errors', 1); //~ ini_set('display_startup_errors', 1); //~ error_reporting(E_ALL); session_start(); include_once("header.php"); include_once("encription_key.php"); include_once("school_admin_access.php"); include_once("school_admin_student.php"); $admin = new adminaccess(); $student = new studentacess(); $encry = new Encryption(); //$school_id = $_SESSION['log_school_id']; //$acadamic_id = $_SESSION['current_academic_id']; $school_id = $_SESSION['child']['log_school_id']; $acadamic_id = $_SESSION['child']['choosen_academic_id']; $route_data = $student->route_data($school_id, $acadamic_id); ?> <style> select { width: 62px !important; background-color: #FFF; border: 1px solid #CCC; } </style> <body style="overflow-x: hidden;"> <div class="row" style="margin-top: 30px;"> <div class="col-md-9 text-start" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:24px;"> <i class=" fa-solid fa-location-dot" title="Route management" style="font-size: 20px;margin: 0px 0px 0px 17px;"></i> Route Management </div> <div class="col-md-2 text-center"> <button type="button" onClick="location.href='add_route.php'" class="btn btn-outline-secondary" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;"> Add Route </button> </div> </div> <div class="row" style="margin-left:10px;margin-right:10px;margin-top:30px;"> <div class="col-md-12 centered" style="font-family: Arial, Helvetica, sans-serif;"> <table id="myTable" class="table table-condensed table-hover" style="margin-top:40px;"> <thead> <tr class="info"> <th class="col-md-1 text-center">Sl.No</th> <th>Route Number</th> <th>Starting Point</th> <th>Destination</th> <th>No.of Stops</th> <th>Vehicle Type</th> <th>Vehicle Number</th> <th>Actions</th> </tr> </thead> <tbody> <?php if ($route_data) { $i = 1; foreach ($route_data as $key => $val) { $stopcount = $student->stop_count($val['route_id']); ?> <tr> <td class="col-sm-1 text-center" style=" font-size:14px;"><?= $i ?></td> <td style=" font-size:14px;"><?= $val['route_number'] ?></td> <td style=" font-size:14px;"><?= $val['source_name'] ?></td> <td style=" font-size:14px;"><?= $val['destination_name'] ?></td> <td style="font-size:14px;"> <?= $stopcount['cnt'] > 0 ? $stopcount['cnt'] - 2 : 0 ?> </td> <td style="font-size:14px;"> <?= $val['vehicle_type'] ?> </td> <td style="font-size:14px;"> <?= $val['vehicle_number'] ?> </td> <td class="text-center"> <a class="buttonn" href="edit_route.php?id=<?= $val['route_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" onclick="return confirm('Do you want to delete the Route ?')" href="delete_route.php?id=<?= $val['route_id'] ?>" style="margin:4px;text-decoration:none"> <i class="fa-solid fa-remove" title="Delete" style="font-size: 14px; color:#01aee6;"></i> </a> </td> </tr> <?php $i++; } } ?> </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 type="text/javascript" language="javascript" class="init"> $(document).ready(function() { /* $('#myTable').DataTable({ "pageLength":100, stateSave: true, dom: 'T<"clear">lfrtip', "oLanguage": { "sSearch": "" }, tableTools: { "aButtons": [ { "sExtends": "xls", "mColumns": [0, 1, 2, 3, 4,5,6,7] }, { "sExtends": "pdf", "sPdfOrientation": "landscape", "mColumns": [0, 1, 2, 3, 4,5,6,7] }, { "sExtends": "print", "mColumns": [0, 1, 2, 3, 4,5,6,7] } ] } }); $('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: 'Route Management<br>Academic Year:<?php echo $_SESSION[child][choosen_year_name] ?><br>', exportOptions: { columns: [0, 1, 2, 3, 4, 5, 6] } }, { extend: 'pdfHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', message: 'Route Management\nAcademic Year:<?php echo $_SESSION[child][choosen_year_name] ?>\n', exportOptions: { columns: [0, 1, 2, 3, 4, 5, 6] } }, { extend: 'excelHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', exportOptions: { columns: [0, 1, 2, 3, 4, 5, 6] } } ] }); }); </script> <script> $(document).ready(function() { $('#myTable').dataTable(); }); </script> </body> </html>