Page 1 of 1
Dinamic select box
Posted: Mon Mar 31, 2003 5:34 am
by Minhoto
Hello,
I want to make 3 dinamic select box's
but when the page apears, only first select box is available.
when user select a value, then second select box will apears,
but the values will be get from a mysql table, an depending of the value of first select box. and thirth select box will appears when user select second value and 3º select box will get values from mysql table, depending of value of 2º select box !
Is this possible ?
can any help me ?
tanks
Posted: Mon Mar 31, 2003 6:46 am
by d1223m
it would help if you posted your code so we understood what you were doing.
as far as i know you can change select box's dynamically ( note the spelling ;), but you will have to load all the data from mysql into the page into javascript arrays/objects as you cannot request new items for the select once the page has been loaded
Posted: Mon Mar 31, 2003 7:40 am
by Minhoto
That's the problem
I dont know how to make this !!
so i haven't any code ....
maybe you can help me finding some script that already do this ...
i know that i must use javascript ...
Posted: Mon Mar 31, 2003 7:46 am
by volka
http://uk.europe.creative.com/support/d ... elcome.asp is an example.
(no I do not work there but I have a soundblaster ...there are many other soundcards available

)
Posted: Mon Mar 31, 2003 7:52 am
by d1223m
im not telling you how to do it but i suggest you look up these things:
1. javascript arrays ( declaring arrays and storing data to them )
2. javascript objects ( storing objects in arrays for more complex stuff )
3. select box onchange event ( who wants to press a button ?
once you understand these you can simply generate the required javascript from php. ( im reasonalby sure this will just be a few arrays you chuck out from mysql)
a simpler soloution to changing the content of the select boxes might be to actually just use several and hide and replace them but im i think you'll just run into other difficulties
Posted: Mon Mar 31, 2003 8:59 am
by daven
viewtopic.php?t=6568
Check out that thread. It is set up for 2 select boxes, but adding a third is easy. The code there does not show/hide the boxes, but rather changes the options available in descending boxes.
Function: choose option in SelectBox1. Option list in select box 2 changes.