//多条件
$tiaojian2= " 2=2 ";
$attr2 = "";
//判断区域
if(!empty($_POST["area"]))
{
$attr2 = $_POST["area"];
$str2 = implode("','",$attr2);
$tiaojian2 = "area in('{$str2}')";
}
//多条件
$tiaojian3= " 2=2 ";
$attr3 = "";
//判断房屋类型
if(!empty($_POST["renttype"]))
{
$attr3 = $_POST["renttype"];
$str3 = implode("','",$attr3);
$tiaojian3 = "renttype in('{$str3}')";
}
//多条件
$tiaojian4= " 2=2 ";
$attr4 = "";
//判断租赁类型
if(!empty($_POST["houesetype"]))
{
$attr4 = $_POST["houesetype"];
$str4 = implode("','",$attr4);
$tiaojian4 = "houesetype in('{$str4}')";
}
?>
$tj=" and 1=1 ";
if(!empty($_POST["gjz"]) && $_POST["gjz"]!== "" )
{ $tj=" and kerword like '%{$_POST['gjz']}%' ";
}
include("fengzhuang.php");
$db = new FENG();
$s="select * from house";
$a=$db->query($s);
echo"
foreach($a as $v)
{
echo"{$v[2]}";
}
echo"
?>
echo"
foreach($a as $v)
{
echo"{$v[5]}";
}
echo"
?>
echo"
foreach($a as $v)
{
echo"{$v[6]}";
}
echo"
?>
关键字 | 区域 | 使用面积 | 租金 | 租赁类型 | 房屋类型 |
$sql="select * from house where {$tiaojian2} and {$tiaojian3} and {$tiaojian4} ".$tj;
$ar=$db->query($sql);
foreach($ar as $v)
{
echo"
";echo"
{$v[1]}{$v[2]}{$v[3]}{$v[4]}{$v[5]}{$v[6]}";echo"
";}
?>
function quanxuanqu(qu)
{
//找到下面所有的复选框
var c=document.getElementsByClassName("quyu");
//遍历所有复选框,设置选中状态
for (var i=0; i
{
if(qu.checked)
{
c[i].setAttribute("checked","checked");
}
else
{
c[i].removeAttribute("checked");
}
}
} function quanxuanfang(fang)
{
//找到下面所有的复选框
var c=document.getElementsByClassName("fangwu");
//遍历所有复选框,设置选中状态
for (var i=0; i
{
if(fang.checked)
{
c[i].setAttribute("checked","checked");
}
else
{
c[i].removeAttribute("checked");
}
}
}
function quanxuanzu(zu)
{
//找到下面所有的复选框
var c=document.getElementsByClassName("zulin");
//遍历所有复选框,设置选中状态
for (var i=0; i
{
if(zu.checked)
{
c[i].setAttribute("checked","checked");
}
else
{
c[i].removeAttribute("checked");
}
}
}