I hope i have posted this in the right place
I want to dynamically generate list box options using the content of an sql database in real time. More specifically, i have a page with a couple of listboxes, when i click on an option in the first list box, i want the second list box to update with options that reflect the first one, in real time generated by the sql database.
- user clicks on an option (say the 3rd option) in the 1st listbox
- php tells sql to search for records that correlate with the 3rd option from listbox 1
i want to do this with out having to refresh the webpage, security issues aint high, cause this project probably aint gonna go on the web. I got the idea from the dynamic searching on google, so i guess such technology is possible some how.
If anybody could help me out i would greatly appriciate it, cause atm i'm at a bit of an in pass, and not sure what direction to proceed.
You can use AJAX to do all that, but it won't work in javscript disabled browsers.
1) put an onchange event on the 1st select list that sends the selected value to a php script, via ajax, to retrieve the records from the database for the selected value.
2) the php script then generates the html for the options in the 2nd select list using the retrieved records.
3) the php generated html is then returned to the ajax function.
4) the ajax function then replaces the html for any options in the 2nd select list with the new html just received.
thanks for your reply! i will take a look at that tommorow, and will report back to let you know how i got on
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)