Current location: Hot Scripts Forums » Programming Languages » PHP » Auto populate drop down list?

Auto populate drop down list?

Reply
  #1 (permalink)  
Old 05-30-05, 11:54 PM
awiekupo awiekupo is offline
Newbie Coder
 
Join Date: May 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Auto populate drop down list?

Hi again,

Need some advice here.. I got 2 drop down list.
Whenever I select the first drop down it will only show certain item in the 2nd drop down list.

Eg:
1 drop down = A (Initially, it contain A,B till Z but let say we select A)
2 drop down = A.a, A.b, A.c until A.z

more eg..
1 drop down = C (Initially, it contain A,B till Z but let say we select C)
2 drop down = C.a, C.b, C.c until C.z

Anyone know where I can get some online tutorial/example to do these kind of coding in PHP?

Cheers!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-31-05, 01:40 AM
Jaffizzle Jaffizzle is offline
Newbie Coder
 
Join Date: May 2005
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
I can provide the theory...

for dropdown 1 lets say you select "A"...you need to use onChange(this->submit()) to $_SERVER['PHP_SELF']

now you have acces to the value "A" to populate the 2nd drop down.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-31-05, 04:06 AM
awiekupo awiekupo is offline
Newbie Coder
 
Join Date: May 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
aha.. tq Jaf. letme try that okay.

tqvm!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 10-23-09, 09:31 AM
halfklingon halfklingon is offline
New Member
 
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rather than using PHP, it will be better if you use PHP to build javascript function to create arrays of items for each selectbox, i.e data_1=new Option('direction','');data_2=new Option('sex','');data_1_1('right',0); data_1_2=new Option('left',1);data_2_1=new Option('female',1);data_2_1=new Option('male',0), etc.
Then, another function to work with 'onChange' to handle selectbox1 change.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 10-23-09, 01:03 PM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 10-23-09, 01:33 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,030
Thanks: 14
Thanked 34 Times in 33 Posts
You could go the easy route and use something like Dynamic Drive's "Chained Select List" script:

Dynamic Drive DHTML Scripts- Chained Select Menu

Or the one from DHTMLGoodies:

Chained select boxes

Or Matt Kruse's Dynamic Option Lists script:

Dynamic Option Lists from JavascriptToolbox.com
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data (scroll down)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 10-31-09, 12:47 PM
Jcbones Jcbones is offline
Coding Addict
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 356
Thanks: 4
Thanked 15 Times in 15 Posts
IMO the best idea.
Quote:
Originally Posted by ruteckycs View Post
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
retrieve information from MYSQL through drop down list minglou PHP 3 04-03-09 10:43 PM
PHP Drop down list Using Oracle RatherSurf PHP 2 02-23-05 02:18 PM
Drop down list change PHP ancdy PHP 5 02-10-05 06:33 AM
multi selection drop down list studenteye PHP 1 07-10-04 08:20 AM
month drop down list angela JavaScript 2 03-31-04 03:33 AM


All times are GMT -5. The time now is 08:27 AM.
vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.