1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2010
    Rep Power

    Populate dropdown by selection

    OK, I know how to dynamically populate a dropdown from database entries, and I know how to use JavaScript/jQuery/Ajax to populate a dropdown from a selected item in another dropdown.

    What I'm have trouble with it how do you populate a dropdown based on a dynamically populated dropdown.

    For example. I have a this code
    PHP Code:
    "SELECT * FROM wp_flr_flights";
    $flight_result mysql_query($flight_sql);
    '<select name="location">';
        while (
    $flt_loc_rows mysql_fetch_assoc($flight_result)) {
    $loc_id $flt_loc_rows["location_id"];
    $loc_name $flt_loc_rows["location_name"];
    ''<option value="'.$loc_id.'">'.$loc_name.'</option>'';
    This populates a dropdown from entries from my database, so If a user selects the first option with the $loc_id value as (ID) 1. How do I populate the next dropdown only with rows from my table that have an (ID) 1.

    I'm thinking it has something to do with using $_GET[] or WHERE in in a query, but I'm not a backend developer and I'm not sure how to go about this.

    I've googled this but I can only find methods using static dropdowns.

    Thanks in advanced.
    Last edited by gilgimech; October 10th, 2012 at 04:11 PM.

IMN logo majestic logo threadwatch logo seochat tools logo