|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
RE: SelectBox Content
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > SelectBox Content |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|