if (strlen($cat) > 0 and !is_numeric($cat)) { // to check if $cat is numeric data or not. echo "Data Error"; exit; } ///////// Getting the data from Mysql table for first list box////////// $objEmployee = new Designation(); $dptResult = $objEmployee->getAllDpt(); ///////////// End of query for first list box//////////// /////// for second drop down list we will check if category is selected else we will display all the subcategory///// if (isset($cat) and strlen($cat) > 0) { $objEmployee = new Designation(); $singleResult = $objEmployee->getSingleEmpDptInfo($cat); } else { $objDesignation = new Designation(); $singleResult = $objDesignation->getAllDesi(); } ////////////////// This will end the second drop down list /////////// ?> <form role="form" action="" method="" > <div class="col-lg-6 col-md-offset-6 form-group"> <div class="input-group"> <div class="input-group-addon">Search</div> <?php echo "<select class='form-control' name='cat' id='empDptName' onchange=\"reload(this.form)\"><option value=''>Select All</option>"; while ($row = mysqli_fetch_array($dptResult)) { if ($row['dptId'] == @$cat) { ?>
<thead> <tr class="success"> <th>Serial Number</th> <th>Department Name</th> <th>Designation Name</th> </tr> </thead> <tbody> <?php $objDesignation = new Designation(); $Desc = "DESC"; $result = $objDesignation->getAllDesi($Desc); //var_dump($result); while ($row = mysqli_fetch_array($result)) { ?> <tr> <td><?php echo $row['desiId']; ?> </td> <td><?php echo $row['dptName']; ?> </td> <td><?php echo $row['desiDesignationName']; ?>