PHP obtains the values in the input box and compares them with the database. The input box

Source: Internet
Author: User

PHP obtains the values in the input box and compares them with the database. The input box

Front end:

<! -- Item query --> <input type = "text" name = "bianhao" value = "" maxlength = "10" size = "10" style = "width: 100px; margin: 0px 0px 0px 25px; height: 20px; "/> <input type =" submit "value =" item number query "style =" margin: 0px 0px 0px 10px; cursor: pointer; background-color: # C30D23; border: 0px; color: # FFFFFF; width: 85px; border-radius: 5px; padding: 3px 0; font-size: 13px; "/>

The php background receives and queries:

Public function MallList () {// write method $ goods = M ('shop _ goods_info '); // instantiate the table corresponding to the database $ codes = I ('Param. bianhao '); // obtain the front-end text box data if (isset ($ codes) & $ codes! = '') {$ Where ['code'] = $ codes; $ this-> assign ('Codes ', $ codes ); // display }}$ info = $ classify-> where (array ('code' => $ code)-> find (); // query syntax

2. Or:

$ _ GET or $ _ POST

<Form action = ''method = 'post'> text box: <input type = 'text' name = 'text'> <input type = 'submit 'value = 'Submit ', name = 'sub'> </form> <? Phpif (! Empty ($ _ POST ['sub']) {echo $ _ POST ['text'];}?>

Replace GET with GET.

The above section describes how to use PHP to obtain the value in the input box and compare it with the database. I hope it will be helpful to you. If you have any questions, please leave a message for me, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

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.