Connecting Tech Pros Worldwide Help | Site Map

Dynamic menus

Jim F
Guest
 
Posts: n/a
#1: Jul 17 '05
I did not include my question in the previous message

I have taken this from another example I saw of where one drop down
list is dependent on the selection of the previous. I can't get the
data to show up in the second menu after I select the first. Anyone
see what I am doing wrong?

Thanks, Jim

<?php
include('./common_db.inc');
$link_id = db_connect();
mysql_select_db("test_aces_data");
?>

<form name=carform action=
<?php echo $_SERVER['PHP_SELF'];
?> method=post>
<?php


$query =mysql_query("select DISTINCT CQ_PROD_PLATFORM AS make_id from
CQ_data ORDER BY make_id");
echo '<select name=make
onchange="document.carform.submit()"'.">"."\n";
if (!isset($make))
{
echo '<option value=null selected>Choose a Make</option>'."\n";
}
while(list($make_id) = mysql_fetch_row($query))
{
echo '<option value='.$make_id;
if (isset($make)&& $make_id == $make)
{
echo " selected";
}
echo '>'."$make_id".'</option>'."\n";
}
echo '</select>'."\n";
echo '<select name=model
onchange="document.carform.submit()"'.">"."\n";
if (!isset($make))
{
echo '<option value=null selected>Choose a Make First</option>'."\n";
}
else
{
$result = mysql_query("select DISTINCT CQ_SUBSYSTEM AS name from
CQ_data where make_id='$make' ORDER BY NAME");
echo '<option value=null selected>Choose a Model</option>'."\n";
while(list($model_id) = mysql_fetch_row($result))
{
echo '<option value=' . $model_id;
if ($model_id == $model)
{
echo " selected";
}
echo '>$model_id</option>'."\n";
}
} echo '</select>'."\n";
?>
steef
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Dynamic menus


Jim~

I'm working on a similar problem with dependent dropdowns in php, and
I'm curious if you ever figured out why your second menu wasn't
populating? If you'd share your solution I'd be grateful. Thanks!
Closed Thread


Similar PHP bytes