How does php obtain the values in the input box for comparison and display in the database? The input box

Source: Internet
Author: User

How does php obtain the values in the input box for comparison and display in 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.

 

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.