By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,327 Members | 2,627 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,327 IT Pros & Developers. It's quick & easy.

Dynamic menus

P: n/a
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";
?>
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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!
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.