Dynamic combo box loading problem, Please HeLp
PHP Guru needed,
Hi All,
I am having issues trying to get a dynamic combo box working.
Requirement : When the user selects a value from the first combo box, I need to include this value as part of a SELECT
WHERE statement to populate the second combo box... See extract of code below:
<select name="add_route" id="add_route" onChange="javascript:loadData()">
<option value="<?php echo $route;?>" SELECTED><?php echo $route;?></option>
<? $sql=mysql_query("select Id,route_name from routes");
while($res=mysql_fetch_array($sql))
{
$rtId=$res['Id'];
echo '<option value="'.$rtId.'"';
echo">".$res['route_name']."</option>";
}
?>
</select>
<select name="add_client" id="add_client" ">
<option value="">---</option>
<?
$sql=mysql_query("select Id,client_name from client where irouteid=$route");
while($res=mysql_fetch_array($sql))
{
$clId=$res['Id'];
echo '<option value="'.$clId.'"';
echo">".$res['client_name']."</option>";
}
?>
</select>
I am a real novice, so any help you can provide is much appreciated
Regards
Steve