Dependent dropdowns or similar, using mootools, php and MySQL
I need to find some way 开发者_高级运维of displaying a drop-down menu that depending on what is chosen will display a second tier of results in another drop-down. All data will be stored in database. Any other similar techniques are welcome. I am currently using mootools, with php and Mysql.
Any help or thoughts welcome on this one...
Basic outline of what you need to do:
Attach an onChange
event to your <select>
control
In the event handler, make a request to a php file (using mootools Request object). Pass the selected value from the form control.
In the php file, grab the form value out of $_POST
and do whatever query you need to get the result set.
If you used Request.HTML, you can build a string that will be inserted into an element when the request finishes. I haven't had much luck using this to build out <select>
controls. I'd probably use Request.JSON, and use the onSuccess
property of your Request.JSON object to build out the new select control.
If anyone is ready this wondering the same, I did find this: Chained Select Which has done the job for me...
精彩评论