<?php include('includes/config/config.php'); include('includes/functions.php'); include('log_entry.php'); $id = $_REQUEST['client_id']; $client_location_options = ""; $sql = "SELECT * from oxygen_cylinder where id='" . $id . "'"; error_log($sql."dmdm"); $result = mysqli_query($conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $r_id = $row['id']; $r_name = $row['loc']; $client_location_options .= "<option selected value=$r_name>$r_name</option>"; } echo json_encode($client_location_options);