i want three dropdowns. The second and third dropdowns need to be dynamically populated by the previous selections. I believe this can be done with ajax & php querying my database.The three dropdowns are puuling data from three different columns in one table.
An example would be something开发者_如何学编程 like this... http://www.kbb.com/used-cars#Can anyone point me in the right direction to get this accomplished?
Any help is MUCH appreciated!
Here : http://php-ajax-code.blogspot.com/2007/07/ajax-triple-dropdown-with-states-cities.html :)
HTML:
three select fields
JavaScript:
use jQuery or some other framework. Then bind "onchange" event for given select field to some javascript function, which makes AJAX request to the php script and sends the selected value.
PHP:
read the value, make the decision and return results. Result can be either HTML or JSON, depends what you really need.
When Javascript gets the results from the given PHP script, you should provide the callback function, which populates the other two fields based on returned value.
精彩评论