ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/get_driver_selection.php |
<?php ob_start(); session_start(); include("inc/config.php"); $transport_name = $_POST['name']; $state = $pdo->prepare("SELECT id FROM tbl_transport where transport_name='$transport_name'"); $state->execute(); $results = $state->fetchAll(PDO::FETCH_ASSOC); foreach($results as $rows) { $transport_id=$rows['id']; } $statement = $pdo->prepare("SELECT * FROM tbl_driver where transport_id=$transport_id"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); $total = $statement->rowCount(); echo '<option value="">Select Driver</option>'; if($total!=0){ foreach ($result as $row) { echo '<option value="'.$row['id'].'">'.$row['driver_name'].' ( Vehicle:'.$row['vehicle_no'].' )</option>'; } } else { echo '<option value="">Driver not available</option>'; } ?>