码迷,mamicode.com
首页 > 其他好文 > 详细

租房子-----多选题

时间:2016-12-23 16:25:10      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:type   highlight   check   ;;   local   多选   查询   submit   mysqli   

	<?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>

  

租房子-----多选题

标签:type   highlight   check   ;;   local   多选   查询   submit   mysqli   

原文地址:http://www.cnblogs.com/hao0/p/6215078.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!