A select drop-down list is made by reading the database + loop method, but the specified value can never be assigned by JS, how to solve it? (Scatter, not enough to fill)

Source: Internet
Author: User
By reading the database + loop method made a Select drop-down list, but always can not be assigned to the specified value by JS, how to solve? (Scatter, not enough to fill)
Think, this and JS is not really related, or PHP problem.

Problem background: The page to the left is a list of some records, the right is a lot of empty boxes to fill in some information, and then save. Then click on one of the records on the left and the relevant information will appear on the right. I've already implemented all of these features.
Problem: Many empty boxes on the right have one of the Select drop-down list to choose which car. My practice is to read the Carnum (integer type) from the database as the value of option in Select, and the values shown are the Licensenum (license plate number) of the vehicle in the database, which is queried and implemented using the PHP loop method. But when I use JS to specify the value of the Select for that ID, the select does not have a single point of response. I changed this select to a certain select (that is, to remove the PHP loop instead of setting the value and the option name directly in the HTM), then JS can specify the value of the select and display the value.

But I want to be able to cycle through the Select, and JS can specify the value (obviously, so it can be displayed dynamically.) )
How to solve it? Scatter, not enough words to reply or private messages to me, can be another supplement.

Directly on the code:


QAZ123 WSX234 EDC345 TGB456


The following is a select that is implemented in a circular fashion:

$query = "SELECT * from Transport.truck order by carnum"; $data = GetAll ($query); foreach ($data as $each) {?>




Here is the JS section I used:

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.