现在我从表中调用taman section
,我只想调用特定的taman部分或者调用表中的所有taman section
,我怎么能这样做?
贝娄是我的代码:
post.php中:
<select name="taman">
<option value="taman1">Taman1</option>
<option value="tamanA">TamanA</option>
<option value="*">ALL</option>
</select>
select.php
$taman = $_POST["taman"]; //this taman are post from post.php,I have tried put value * to this $taman, but still cannot.
$qry="SELECT cusinfo.* FROM cusinfo
WHERE cusinfo.TAMAN_SECTION = '$taman'
";
答案 0 :(得分:0)
你也可以试试这个
$taman = $_POST["taman"];
if($taman=='*'){
$qry="SELECT cusinfo.* FROM cusinfo ";
}
else{
$qry="SELECT cusinfo.* FROM cusinfo WHERE cusinfo.TAMAN_SECTION = '".$taman."'";
}
此处无需更改html选项。