PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 10th, 2012, 03:31 PM
gilgimech gilgimech is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2010
Posts: 46 gilgimech User rank is Sergeant (500 - 2000 Reputation Level)gilgimech User rank is Sergeant (500 - 2000 Reputation Level)gilgimech User rank is Sergeant (500 - 2000 Reputation Level)gilgimech User rank is Sergeant (500 - 2000 Reputation Level)gilgimech User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 15 h 22 m 12 sec
Reputation Power: 9
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:
<?php
    $flight_sql 
"SELECT * FROM wp_flr_flights";
    
$flight_result mysql_query($flight_sql);
    echo 
'<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"];
        echo 
''<option value="'.$loc_id.'">'.$loc_name.'</option>'';
    }
    echo 
'</select>';
?>


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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Populate dropdown by selection

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap