1<! DOCTYPE html Public"-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >234<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>5<title> Untitled Document </title>67 8<body>9 Ten<!--<textarea style= "Overflow:scroll;" ></textarea> Text Fields-- One<!--when I click on the query will send the data to the current page, submitted to the current page-- A<?PHP - $db=NewMysqli ("localhost", "root", "511108", "text"); - //on this page, we can put the submitted data here. the //When you make a query, pass over a few data to make a few conditions - $TJ 1= "1=1"; - $TJ 2= "1=1"; - $TJ 3= "1=1"; + $TJ 4= "1=1"; - + //conditions of the area A //var_dump ($_post["QX");//test Output at if(!Empty($_post["QX"]) &&Count($_post["QX"]) >0)//Judge Countyaodayu 0 if it's equal to zero or check all - { - //$TJ 1 = ""; - $QX=$_post["QX"];//this is an array to convert the array to a string - //select * from info where code in (' Type ', ' Quantity ', ' ', ' ', ')//array Each element is a value. How to spell a string: Implode method with split string (', ' stitching) - $str=implode("‘,‘",$QX); in //echo $str;//Output - $TJ 1= "area in (' {$str}‘) ";//Complete Conditions to //echo $tj 1;//output to see if tj1 is the complete condition . + } - //conditions for Lease type the if(!Empty($_post["ZL"]) &&Count($_post["ZL"]) >0) * { $ $zl=$_post["ZL"];Panax Notoginseng $str=implode("‘,‘",$zl); - $TJ 2= "Renttype in (' {$str}‘) "; the } + //conditions of the housing type A if(!Empty($_post["FW"]) &&Count($_post["FW"]) >0) the { + $FW=$_post["FW"]; - $str=implode("‘,‘",$FW); $ $TJ 3= "Housetype in (' {$str}‘) "; $ //echo $TJ 3; Test output - } - //Criteria for Keywords the if(!Empty($_post["Key"])) - {Wuyi $key=$_post["Key"];//Give $_post["key" to $key variable the $TJ 4= "keyword like '%{$key}%‘ ";//do not empty to become the keyword fuzzy query, the $key variable to bring over - } Wu - About?> $ - - -<form action= "fangwu12.php" method= "POST" > A<div> + Area: the<input type= "checkbox" Name= "QX"/>Select All -</div> $<div> the<?PHP the $SQLQ= "SELECT distinct area from house";//go to heavy distinct the $rq=$db->query ($SQLQ); the $aq=$rq-Fetch_all (); - foreach($aq as $v)//Loop Output in { the Echo"<input type= ' checkbox ' name= ' qx[] ' value= ' {$v[0]} ' />{$v[0]} ";//name= ' qx[] ' submitted as an array the } About?> the</div> the<br/> the +<div> - type of leasing: the<input type= "checkbox" Name= "QX"/> Full selection </div>Bayi<div> the<?PHP the $sqlz= "SELECT distinct Renttype from house";//go to heavy distinct - $rz=$db->query ($sqlz); - $az=$rz-Fetch_all (); the foreach($az as $v)//Loop Output the { the Echo"<input type= ' checkbox ' name= ' zl[] ' value= ' {$v[0]} ' />{$v[0]} "; the } -?> the</div> the<br/> the 94<div> the type of house: the<input type= "checkbox" Name= "QX"/> Full selection </div> the<div>98<?PHP About $SQLF= "SELECT distinct housetype from house";//go to heavy distinct - $RF=$db->query ($SQLF);101 $af=$RF-Fetch_all ();102 foreach($af as $v)//Loop Output103 {104 Echo"<input type= ' checkbox ' name= ' fw[] ' value= ' {$v[0]} ' />{$v[0]} "; the }106?>107</div>108<br/>109<div> the Key Words:111<input type= "text" name= "key"/> the<input type= "Submit" value= "Query"/>113</div> the<table width= "100%" border= "1" cellpadding= "0" cellspacing= "0" > the<tr> the<td> keywords </td>117<td> Area </td>118<td> Construction Area </td>119<td> Rent </td> -<td> Leasing Type </td>121<td> Housing Type </td>122</tr>123<?PHP124 $sqlall= "SELECT * from house where {$TJ 1} and {$TJ 2} and {$TJ 3} and {$TJ 4}"; theecho $sqlall;//Do not select anything is the default all
$rall=$db->query ($sqlall);126 $aall=$rall-Fetch_all ();127 foreach($aall as $v) - {129 Echo"<tr> the<td>{$v[1]}</td>131<td>{$v[2]}</td> the<td>{$v[3]}</td>133<td>{$v[4]}</td>134<td>{$v[5]}</td>135<td>{$v[6]}</td>136</tr> "; 137 }138 139?> $ 141 142</table>143 144</body>145PHP Production Enquiry Rental Form