PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

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 Codewalkers Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old September 10th, 2002, 11:22 PM
alsaffar alsaffar is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 58 alsaffar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
SelectBox Content

Hi guys,

How can make my select boxe's content dynamicaly changed?

If I have (lets say 2 select boxes), and thier values are taken from the DB by while loop. How can I get the second select box values that are related to the first select boxt by just selecting a value from the first select box.

(i.e. the first select box have (Ferrari, Porsche, Jaguar) and the second select box is empty until I select a value from the first select box, (lets say I select Porsche) then the second select box automaticaly will have (911, 968, 959) values!!!

How can I achieve that?

Reply With Quote
  #2  
Old September 11th, 2002, 02:14 AM
guyer guyer is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Bloomington, IN USA
Posts: 47 guyer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to guyer
RE: SelectBox Content

well, you have several options. I'm not sure which is best...

you could reserve the page entirely and build the second select box based on the selected value of the first. You can do this using a javascript 'onChange' event in the first select box.

You could do it entirely in javascript by building arrays in javascript using php. Then, populate the second selectbox with the appropriate array based on what's selected in the first selectbox. You could do this in a javascript function which is called on the 'onChange' event. This may not be what you're looking for since your DB is probably very large.

You could also do something similar to the above using hidden divs (using the visiblity property in CSS). Just build every possibility of the second select box in php and enclose in a hidden div. Then, show the appropriate div triggered, again, by the 'onChange' event.

I'm sure there are other options but I can't think of any at the moment.

Reply With Quote
  #3  
Old September 11th, 2002, 02:15 AM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: SelectBox Content

it is good idea for (all) users to browse around forum a bit, before they post...

this is why

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > SelectBox Content


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway