您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP获取input输入框中的值去数据库比较显示出来

2024/3/5 14:19:12发布17次查看
前端:
<!--商品查询--> <input type="text" name="bianhao" value="" maxlength="10" size="10" style="width:100px; margin:0px 0px 0px 25px;height:20px;"/> <input type="submit" value="商品编号查询" 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后台接收并查询:
public function malllist(){ //写方法 $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
<form action='' method='post'> 文本框:<input type='text' name='text'> <input type='submit' value='提交',name='sub'> </form> <?php if(!empty($_post['sub'])){ echo $_post['text']; } ?>
如果是get 就换成get
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product