PHP gets input in the input box to the value of the database comparison display _php instance

Source: Internet
Author: User

Front:

<!--product Inquiries--> 
<input type= "text" name= "Bianhao" value= "" maxlength= "" size= "" style= "width:100px; margin:0px 0px 0px 25px;height:20px; " /> 
<input type= "Submit" value= "Product 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; " />

PHP background to receive and query:

Public Function Malllist () {//write method
$goods =m (' shop_goods_info ');//instantiate database corresponding table
$codes =i (' Param.bianhao '); Gets the foreground 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:

With $_get or $_post.

<form action= ' method= ' post ' >
text box: <input type= ' text ' name= ' text ' >
<input ' Submit ' value = ' Submit ', name= ' Sub ' >
</form>
<?php
if (!empty ($_post[' Sub ')) {
echo $_post[' text '];
}
? >

If it's a get, replace it

The above is a small set up to introduce PHP to get input into the value of the box to the database comparison show, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.