Hi i need a double combobox which needs the data to be fetched from the database dynamically.
database details there are two fields in the database name and email address
name email
Vamsi vamsi@vamsi.com
Vamsi krishna@vamsi.com
Krishna xyz@xyz.com
Krishna xyz@xyz.com
i need to fill the first combobox only with the names Vamsi and Krishna
If i select the name as Vamsi i need to get the two email address corresponding to Vamsi.
I was successful in populating one combobox.I failed in selections. Any sort of code help is appreciated.
double combobox
Moderator: General Moderators
-
impulse()
- Forum Regular
- Posts: 748
- Joined: Wed Aug 09, 2006 8:36 am
- Location: Staffordshire, UK
- Contact:
Firstly, I'd grab the names and e-mails from the database and store them in an array.
Secondly, generate the combo box in a loop that loops through as many times as there are items in the array using: for the values of each combo option.
Secondly, generate the combo box in a loop that loops through as many times as there are items in the array using:
Code: Select all
value = '$yourArray[$i]'- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
On this site I have created a couple of topics on this...
Javascript and Dynamic Select Boxes
Dynamic/Chained Selects using Ajax with Prototype
At some point soon I will probably do another example using the JQuery javascript library.
Javascript and Dynamic Select Boxes
Dynamic/Chained Selects using Ajax with Prototype
At some point soon I will probably do another example using the JQuery javascript library.
PHP only
Is it possible to do it without using javascript (using only php).
I created two combobox filling with php and mySql.
But I need the second combobox to show choice based on the selection of the first combobox.
How do I do that ?
Thank you in advance.
I created two combobox filling with php and mySql.
But I need the second combobox to show choice based on the selection of the first combobox.
How do I do that ?
Thank you in advance.
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
If you do not have javascript (or don't want to use it) your only alternative is to submit the form when the user selects the first item. This is normally performed with a submit button next to the first select item.
Dynamic/Chained Selects using Ajax with Prototype has an example which works even with javascript switched off.
Dynamic/Chained Selects using Ajax with Prototype has an example which works even with javascript switched off.