Hi,
I am creating a module in PHP where in, based on the drop down value selected, list of its corresponding values are to be displayed in the form of check boxes and the user can select multiple check boxes and post the same to the database.
Could some one throw pointers or a sample code which would help me immensely
Ajax based check boxes based on drop down value selected
Moderator: General Moderators
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Ajax based check boxes based on drop down value selected
Setup a database with two tables: one for the dropdown box, and one for checkboxes. Each row in the dropdown box table has an ID, and a value. Each row in the checkboxes database has an ID, a value, and a the ID of the dropdown box table row it's a child of. Then, when the user selects a item in the dropdown box, you would run some SQL like "SELECT * FROM checkboxes WHERE dropdown_id = (user selected item)".
Now, if you want to do this without loading a new page, that's Javascript (and maybe AJAX).
Now, if you want to do this without loading a new page, that's Javascript (and maybe AJAX).