How does the data in the drop-down list dynamically read the content of database fields?

Source: Internet
Author: User
How does the data in the drop-down list dynamically read the content of database fields? Select name = "cp_kh" id = "selModule">


When you click the drop-down list, the data in the drop-down list is dynamically retrieved from the database. How can I get the data of all rows under a field from the database table to the drop-down list. The drop-down list is arranged by a row of read data. Php reads data table fields and assigns values to the read data drop-down list. (How to implement it ?) For example,


Reply to discussion (solution)

I don't know what it means, and I didn't see a picture.



For example, the data in the 'customer name' field column is queried, such as customer A, Customer B, customer C, and customer D ..., assign the values of the data below this column to the drop-down list. you can select a customer to display a row.

When you click the drop-down list, the data in the drop-down list is dynamically retrieved from the database.
This is a poor user experience and will not be adopted.
The data in the list should be preset.

If the list is assigned by another control, you can use ajax

$ Result = mysql_query ("select customer name as name from table"); echo''; While ($ row = mysql_fetch_assoc ($ result) {echo"";} Echo'';

The drop-down list must contain the database, and the preset content cannot meet this requirement.
For example, the customer adds dynamic updates to the database, but it is not necessarily dead. When adding a product, you must select the target customer. Therefore, the product must be dynamic.

    Vehicle type  
 
  
 

The above code is perfect. Thank you very much.

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.