Dynamic menus

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim F

    Dynamic menus

    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_dat a");
    ?>

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


    $query =mysql_query("s elect DISTINCT CQ_PROD_PLATFOR M AS make_id from
    CQ_data ORDER BY make_id");
    echo '<select name=make
    onchange="docum ent.carform.sub mit()"'.">"."\n ";
    if (!isset($make))
    {
    echo '<option value=null selected>Choose a Make</option>'."\n";
    }
    while(list($mak e_id) = mysql_fetch_row ($query))
    {
    echo '<option value='.$make_i d;
    if (isset($make)&& $make_id == $make)
    {
    echo " selected";
    }
    echo '>'."$make_id". '</option>'."\n";
    }
    echo '</select>'."\n";
    echo '<select name=model
    onchange="docum ent.carform.sub mit()"'.">"."\n ";
    if (!isset($make))
    {
    echo '<option value=null selected>Choose a Make First</option>'."\n";
    }
    else
    {
    $result = mysql_query("se lect 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($mod el_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

    #2
    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!

    Comment

    Working...