0
I am using the code below to populate a dropdown in another page. The echo does give me the amoclient text however its not passing it to the $client in the SELECT part. I have changed the $client in the SELECT to a text like (“SELECT pcode FROM tbl_project WHERE pclient=‘myName’”) for a test and this does work and populate the dropdown with the pcode list from the database. I am not sure what is causing this not to work using the variable $client. Please assist.
<?php
require_once "dbConn.php";
$client = $_POST["amoclient"];
echo "<script>alert('$client');</script>";
$result = mysqli_query($db,"SELECT pcode FROM tbl_project WHERE pclient=$client");
?>
<option value="">Select Project Code</option>
<?php
while($row = mysqli_fetch_array($result)) {
?>
<option value="<?php echo $row["pcode"];?>"><?php echo $row["pcode"];?></option>
<?php
}
?>