How does PHP interact with the drop-down list? Solution

Source: Internet
Author: User
How does PHP interact with the drop-down list? For example, I have a table with two fields: name. a drop-down list of the class reads all the data of the class from the database, and a drop-down list reads all the names of the classes. How to do this ?, Use ajax to retrieve data. js/jquery to update page content or read all data at a time to write PHP. how does one implement linkage of the drop-down list?
For example, I have a table with two fields: name. a drop-down list of the class reads all the data of the class from the database.


Output all names. How can this be done?

------ Solution --------------------
Use ajax to retrieve data. js/jquery to update page content
Or read all the data and write it to the page at a time.
------ Solution --------------------
I always think there is a problem with your table design.
Is this name the name of the class or the name of the student ???
------ Solution --------------------
Drop-down menu
Onchange event

Then use ajax to request the server
------ Solution --------------------
What does this have to do with PHP? Search for links by yourself, with a bunch of code
------ Solution --------------------
It is not suitable for students and classes to be placed in a table.
Student table: sid, sname, classid
Class table: classid, classname

The first drop-down menu reads the class table,
Ajax is used for association. when the data in the first drop-down menu is changed and an event is triggered, student table is selected based on the classid and all name values are listed in the second menu.

I don't know what name is. The above is just a general description. if you have any questions, you can just take a look.
Hey.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.