表单查询的解决方案 开源系统 更新 2017-05-06 00:26:32 迅睿粉丝 请教大家一个关于表单查询的问题1、同时满足两个条件,查询出相对应的一条表单记录。2、如果没有满足条件的记录,则返回一个提示,譬如:“对不起,没有查询到满足条件的记录!”请教具体的实现方法的相关代码,谢谢!
{list action=form form=xxxx 条件1=条件1的值 条件2=条件2的值} {/list} {if !$count} 对不起,没有查询到满足条件的记录! {/if}解决<form action="index.php" method="post" name="Frmsearch" id="Frmsearch"> <input type="hidden" name="c" value="form_zscxedu"> <label class="control-label col-md-2"><font color="red">*</font>姓名:</label> <input class="form-control" type="text" name="sname" id="dr_title" value="" style="width:200px;" required="required" /> <label class="control-label col-md-2">会员编号:</label> <input class="form-control" type="text" name="zsedunum" id="dr_zsbh" value="" style="width:200px;" /> <div style="max-width:615px; margin-top:20px; text-align:center"><input type="submit" value="查询" name="submit" class="educxbut" style="line-height:24px; color:#fff; font-size:16px; margin-right:20px; padding:3px 20px; cursor:pointer;"/></div> </form> 前提是 sname和zsedunum是主表字段 {list action=form form=zscxedu sname=$get.sname zsedunum=$get.zsedunum} 姓名:{$t.sname} {/list} {$error}{$sql} {if !$count} 对不起,没有查询到满足条件的记录! {/if}http://help.xunruicms.com/27.html
查询结果页面关键信息
<?php
$post_data = $_POST;
$fieldnum = $_POST['Zsedunum'];
$fieltitle = $_POST['sname'];
?>
{list action=sql sql='select * from dr_1_form_zscxedu where title="$fieltitle" and zsbh="$fieldnum" '} ……………………