租房子-----多选题
Posted 徐文昊
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了租房子-----多选题相关的知识,希望对你有一定的参考价值。
<?php $db = new mysqli("localhost","root","112834","hao"); $tj1 = "1=1"; $tj2 = "1=1"; $tj3 = "1=1"; $tj4 = "1=1"; if(!empty($_POST["qx"]) && count($_POST["qx"])>0) { $qx = $_POST["qx"]; $str = implode("‘,‘",$qx); $tj1 = " area in(‘{$str}‘) "; } if(!empty($_POST["zl"]) && count($_POST["zl"])>0) { $zl = $_POST["zl"]; $str = implode("‘,‘",$zl); $tj2 = " renttype in(‘{$str}‘) "; } if(!empty($_POST["fz"]) && count($_POST["fz"])>0) { $fw = $_POST["fz"]; $str = implode("‘,‘",$fz); $tj3 = " housetype in(‘{$str}‘) "; } if(!empty($_POST["key"])) { $key = $_POST["key"]; $tj4 = " keyword like ‘%{$key}%‘ "; } ?> <h1>租房子</h1> <form action="duoxuan.php" method="post" > <div>区域:<input type="checkbox" />全选</div> <div> <?php $sqlq = "select distinct area from fangzi"; $rq = $db->query($sqlq); $aq = $rq->fetch_all(); foreach($aq as $v) { echo"<input type=‘checkbox‘ name=‘qx[]‘ value=‘{$v[0]}‘ />{$v[0]}" ; } ?> </div> <div>租赁类型:<input type="checkbox" />全选</div> <div> <?php $sqlz = "select distinct renttype from fangzi"; $rz = $db->query($sqlz); $az = $rz->fetch_all(); foreach($az as $v) { echo"<input type=‘checkbox‘ name=‘zl[]‘ value=‘{$v[0]}‘ />{$v[0]}" ; } ?> </div> <div>房屋类型:<input type="checkbox" />全选</div> <div> <?php $sqlx = "select distinct hotsetype from fangzi"; $rx = $db->query($sqlx); $ax = $rx->fetch_all(); foreach($ax as $v) { echo"<input type=‘checkbox‘ name=‘fz[]‘ value=‘{$v[0]}‘ />{$v[0]}" ; } ?> </div> <div>关键字:<input type="text" name="key" /> <input type="submit" value="查询" /></div> </form> <table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td>关键字</td> <td>区域</td> <td>面积</td> <td>租金</td> <td>租赁类型</td> <td>房屋类型</td> </tr> <?php $sqlall = "select * from fangzi"; $rall = $db->query($sqlall); $aall = $rall->fetch_all(); foreach($aall as $v) { echo "<tr> <td>{$v[1]}</td> <td>{$v[2]}</td> <td>{$v[3]}</td> <td>{$v[4]}</td> <td>{$v[5]}</td> <td>{$v[6]}</td> </tr>"; } ?> </table>
以上是关于租房子-----多选题的主要内容,如果未能解决你的问题,请参考以下文章
PHP-----练习-------租房子-----增删改查,多条件查询
2016/3/30 租房子 ①建立租房子的增删改php页面 ②多条件查询 ③全选时 各部分全选中 任意checkbox不选中 全选checkbox不选中