<?php @($cat = $_GET['cat']); // Use this line or below line if register_global is off 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>";