Fuzzy query in PHP and associate with three select boxes to fuzzy query select

Source: Internet
Author: User

Fuzzy query in PHP and associate with three select boxes to fuzzy query select

1. in php, we often use drop-down boxes and associate them with each other. If there are many options in the drop-down box, we need to use the fuzzy search function. How can we do this?

This function takes a detour. It is best not to associate two select id values and select the select attribute, which cannot be modified. Remove the attribute when selecting the select attribute again, so that Firefox and google js are compatible when removing the select attribute. It is easy to see non- ing or attributes that cannot be removed, and the features are troublesome. In addition, you must determine the relationship between the two in the background. (When comparing the relationship between the two in the background, go to the database query, find the enterprise id, go to the Database Query guarantee company id comparison. Do not use the front-end to obtain the id of the Guarantee Company ).

2. style:

Associated with each other. If a company has a guarantee, only one company is displayed in the drop-down list. If other companies are not displayed, all are displayed. Select an administrator.

3. we know that the select drop-down box does not allow a search box or an input search box. In this way, we can only use the plug-in to convert the select box to ul li. This is a very useful plug-in: select2.

4. Normally obtain data and assign values in the background database. Introduce the select2 plug-in. Note that css files related to the select2 plug-in should also be introduced. Some css prices and js are encapsulated, and the style should be changed by yourself.

5. Add a style:

. Select2-results _ option [aria-selected] {
Cursor: pointer;
Font-size: 14px;
}
. Select2-container -- default. select2-selection -- single. select2-selection _ rendered {
Color: #444;
Line-height: 28px;
Font-size: 14px;
}
. Select2-container -- default. select2-results>. select2-results _ options {
Max-height: 280px;
Overflow-y: auto;
}

6. associations between drop-down boxes:

7.

8. js processing: Obtain the hidden select value and recreate the select option (Note: After the select is hidden, its value still exists and can be used)

The above is a small series of PHP fuzzy queries and associated with three select boxes, I hope to help you, if you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.