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!