Frontend:
<!--商品查询--> <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-Hintergrundempfang und -abfrage:
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. Oder:
hat $_GET oder $_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']; } ?>
Wenn es GET ist, ändern Sie es in GET