PHP获取input输入框中的值去数据库比较显示出来
前端:
<!--商品查询--> <inputtype="text"name="bianhao"value=""maxlength="10"size="10"style="width:100px;margin:0px0px0px25px;height:20px;"/> <inputtype="submit"value="商品编号查询"style="margin:0px0px0px10px;cursor:pointer;background-color:#C30D23;border:0px;color:#FFFFFF;width:85px;border-radius:5px;padding:3px0;font-size:13px;"/>
php后台接收并查询:
publicfunctionMallList(){//写方法
$goods=M('shop_goods_info');//实例化数据库对应的表
$codes=I('param.bianhao');//获取前台文本框数据
if(isset($codes)&&$codes!=''){
$where['code']=$codes;
$this->assign('codes',$codes);//显示
}
}
$info=$classify->where(array('code'=>$code))->find();//查询语法
2.或者:
有$_GET或者$_POST
<formaction=''method='post'>
文本框:<inputtype='text'name='text'>
<inputtype='submit'value='提交',name='sub'>
</form>
<?php
if(!empty($_POST['sub'])){
echo$_POST['text'];
}
?>
如果是GET就换成GET
以上所述是小编给大家介绍的PHP获取input输入框中的值去数据库比较显示出来,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!
热门推荐
10 新人红包祝福语简短精辟
11 幼师给毕业祝福语简短
12 生日高考祝福语妹妹简短
13 下飞机祝福语简短英文
14 元宵发客户祝福语简短
15 爸妈金婚文案祝福语简短
16 新郎朋友红包祝福语简短
17 虎年五一祝福语大全简短
18 出阁宴祝福语姐姐简短