Multiple Drop-Down Menus
I imagine there is a name for what I am trying to accomplish, but I don't know of it, so I apologize if I confuse anyone with what i'm looking to do:
I have a particular MySQL table that lists from a large table of businesses. Inside of the table with the businesses, I have a city field.
It is to the point that performance is becoming an issue within a HTML form. Can I modify my forms to have a city drop down menu, then once a user selects a city, a list of businesses that matches that city will show up in a second drop down for the user to choose? I imagine jQuery might do the trick, but if there is another way, or if anyone has a jQuery example, I would appreciate it!
Sounds like a perfect application for php and ajax. When your send the page to the client the city <select> is populated. When a selection is made the onchange event of the select tag will call a JS function that will take the value selected, make the ajax call to a php script that grabs the businesses you want and returns the data back to the calling JS which then populates the contents of the 2nd select tag for businesses.
Need some simple JS skills to grab the initial city value, some more to execute the ajax call (google!) and a little bit at the end to populate the business drop-down and make it visible.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)