简体   繁体   中英

Can I use DropDown menus to retrieve values from a database

Below is the "Room" table in the database:

   Room          Building            Capacity
    CW5/10        Canalside West        50
    CW4/09        Canalside West        40
    CW2/08        Canalside West        40
    CW4/10        Canalside West        25
    CE1/03        Canalside East        40

What I want to do if it is possible is to create 2 dropdown menus. One dropdown menu is for the "Building" field where it will displays all the buildings as individual values in the dropdown list and then in the second drop down menu, it will display the list of rooms which is

You can adapt this AJAX example to do what you need.

http://www.w3schools.com/php/php_ajax_database.asp

Just adapt the getuser.php file to show another drop down list rather than the table.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM