Tutorial :Load options for listbbox from Mysql to listbox, controled by other list - Javascript



Question:

I don't know the name for this, if did i would search for it.

I wanted something like this, i think its uses javascript but I'm not sure how to do it know.

In a web page you have 2 listboxs, its content comes from mysql.

There is 2 tables in the database, for each listbox, they are both related.

Then when you select a item from the listbox 1 we dynamically loads the options for listbox 2 based on the selection you made in listbox1, and if you change the selection it listbox 1 he also changes the options for listbox 2.

I think i've expressed correctly, if its confused just say it.

Thanks for the help once again.


Solution:1

http://remysharp.com/2007/09/18/auto-populate-multiple-select-boxes/ is a jquery plugin using PHP and mySQL

Josh


Solution:2

http://www.onlinetools.org/articles/accessibleinter/ is a good article on this subject. It doesn't go into how you would generate the HTML, but it should be pretty easy to do that in your server side programming language of choice.


Solution:3

Sounds like you are looking for some combination of Ajax + Server side language + MySQL.

Ajax can be handled with: - jQuery - Mootools - Home brew XmlHttpResponse

Server side can be: - C# - Java - PHP - Ruby

Using JavaScript to attach to the onChange event of the first list box, you would then use ajax to get the second listbox contents (based on the selected item in the first list)


Solution:4

It can be done using AJAX.

You need to make a server side call from Javascrpit. And return XML response from Server side call.

Cheers


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »