Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SelectBox Content

Status
Not open for further replies.

alsaffar

Programmer
Oct 25, 2001
165
KW
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?
 
Use a multidimensionalarray. Get all marks ie: ferrari, porsche and jaguar as the first element, and fill the next element with the types.
$car['ferrari']['testarossa']
$car['ferrari']['maranello'] etc.

Or, and that is i think not what you want. Use javascript to reload the page with the correct arguments after selecting ferrari. On the reload, query the db and get the types matching the car.

If there are not to many records, i would go for the first option so you dont have to reload a page.

In both cases you have to use javascript. mcvdmvs
"It never hurts to help" -- Eek the Cat
 
you have to do that in JS ... or else you need to refresh submit the first select and fill the second. Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top