租房表

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<?php
include("DBDA.php");
$db = new DBDA();
$sql = "select distinct area from house";
$nr = $db->Query($sql);
$sql1 = "select distinct renttype from house";
$nr1 = $db->Query($sql1);
$sql2 = "select distinct housetype from house";
$nr2 = $db->Query($sql2);
?>
<form action="0509test.php" method="post">
<div>区域:&nbsp;全选<input type="checkbox" id="xx" onclick="show(this,'xx')" /></div><br />
<div>
<?php
foreach($nr as $v)
{

echo "{$v[0]}<input type='checkbox' class='xx' value='{$v[0]}' name='dy[]'/>&nbsp;";
}
?>
</div>
<div>租赁类型:&nbsp;全选<input type="checkbox" id="zl" onclick="show(this,'zl')" /></div><br />
<div>
<?php
foreach($nr1 as $v)
{

echo "{$v[0]}<input type='checkbox' class='zl' value='{$v[0]}' name='zl[]'/>&nbsp;";
}
?>
</div>
<div>房屋类型:&nbsp;全选<input type="checkbox" id="fw" onclick="show(this,'fw')" /></div><br />
<div>
<?php
foreach($nr2 as $v)
{

echo "{$v[0]}<input type='checkbox' class='fw' value='{$v[0]}' name='fw[]'/>&nbsp;";
}
?>
</div>
<div>关键字:<input type="text" name="gj"/></div>
<input type="submit" value="搜索"/>
</form>
<?php
$nr = "1=1";
$zl = "1=1";
$fw = "1=1";
$gj = "1=1";
if(!empty($_POST["dy"]))
{
$nr3 = $_POST["dy"];
$nr4 = implode("','",$nr3);
$nr = " area in ('{$nr4}')";

}
if(!empty($_POST["zl"]))
{
$zl3 = $_POST["zl"];
$zl4 = implode("','",$zl3);
$zl = " renttype in ('{$zl4}')";

}
if(!empty($_POST["fw"]))
{
$fw3 = $_POST["fw"];
$fw4 = implode("','",$fw3);
$fw = " housetype in ('{$fw4}')";

}
if(!empty($_POST["gj"]))
{
$gj3 = $_POST["gj"];
$gj = " keyword like '%{$gj3}%'";
}
$tj = " where {$nr} and {$zl} and {$fw} and {$gj}";
$sql3 = "select * from house".$tj;
$cx = $db->Query($sql3);

?>
<table border="1" cellpadding="0" cellspacing="0">
<tr><td>关键字</td><td>区域</td><td>建筑面积</td><td>租金</td><td>租赁类型</td><td>房屋类型</td></tr>
<?php
foreach($cx 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>

</body>
<script type="text/javascript">
function show(a,b)
{
var xz = a.checked;
var ck = document.getElementsByClassName(b);

for(var i=0;i<ck.length;i++)
{
ck[i].checked = xz;
}
};

</script>
</html>

最新文章

  1. 重置EntityFramework数据迁移到洁净状态
  2. 【2016-11-2】【坚持学习】【Day17】【微软 推出的SQLHelper】
  3. java创建线程的几种方式
  4. HDU3138 Coconuts(最小割)
  5. MVC项目实践,在三层架构下实现SportsStore-10,连接字符串的加密和解密
  6. JS之DOM(二)
  7. Android源代码下载方法具体解释
  8. android学习日记25--ANR和Hander消息机制
  9. Python的设计模式学习
  10. 为什么很多语言选择在JVM上实现
  11. poj3468 线段树+lazy标记
  12. ECSTORE 货币格式
  13. bullet_01
  14. 【SCOI2008】着色方案
  15. 前端面试题(4)iframe有哪些优点?iframe缺点是什么?
  16. pycharm clion phpstorn全家桶激活码(可以用到2019年4月)
  17. ActiveRecord Nested Atrributes 关联记录,对嵌套属性进行CURD
  18. SQL-46 在audit表上创建外键约束,其emp_no对应employees_test表的主键id。
  19. Installing PHP5 on Ubuntu Server
  20. 手动安装 MyEclipse6.5 FindBugs

热门文章

  1. 自己定义 View 基础和原理
  2. U4699 鸡蛋
  3. 百度MP3+图片+文字:生成结果文件;(声音58秒,视频59秒,同步性需要进一步优化)
  4. UVALive 4212 - Candy
  5. Python:SMOTE算法——样本不均衡时候生成新样本的算法
  6. php获得两个字符串公共最大子串的函数
  7. [Swift通天遁地]三、手势与图表-(3)通过捏合手势放大和缩小图像视图
  8. [Swift通天遁地]三、手势与图表-(6)创建包含三条折线的线性图表
  9. python网络爬虫之图片链家在技术.seleninum和PhantonJS
  10. Spring思维课程导图——bean属性的设置