提交表单查询
1、HTML端
<form action="{:U('Index/rewardlog')}" method="post" > <div class="search-tj"> <span style="color: #3dcbe3">*请输入昵称|中奖码|手机号|奖品名称</span> <span><input class="search-txt" type="text" name="input" value="{$input}" /> <input class="search-sub" type="submit" value="搜索"></span> </div> </form>
2、PHP端
$where = ' r.statu = 1 AND r.is_show !=0 '; if($_POST){ $input = trim($_POST['input']); if($input != ''){ $where .= 'AND (u.nickname like \'%'.$input.'%\' OR u.mobile like \'%'.$input.'%\' OR r.message_code like \'%'.$input.'%\' OR p.pname like \'%'.$input.'%\') group by r.id'; } } $sql ="select r.id,u.nickname,u.mobile,p.pname,r.rid,r.money,r.choosetime,r.message_code,r.gettime From `1008_reward` r left join `1008_prize` p ON r.rid = p.id left join `1008_user` u ON r.uid = u.id where $where";