0

嗨,我是 php 新手,知识很少,在我的 where 语句中,我有 where Status='A' 和 z.zoneID=1,有没有办法让页面用户控制 z.zoneID=1,以便他们可以通过下拉列表将其更改为任何可用的 zoneID?

////////Query & Data Display is here/////////

$q=mysql_query("select r.*, f.Functionname,  m.Managername, z.Zonename from requests as r  inner join functions as f on r.functionID = f.functionID inner join managers as m on r.managerID = m.managerID inner join zones as z on r.zoneID = z.zoneID where Status='A' and     z.zoneID=1 order by Functionname");


echo "<table>
<tr>
<th>Function</th>
<th>Manager</th>
</tr>"
;
while($nt=mysql_fetch_array($q)){
echo"<b>Zone: $nt[Zonename]<br>Capacity: $nt[Zonecapacity]</b><br><br>";
echo "<tr><td>$nt[Functionname]</td><td>$nt[Managername]</td></tr>";
}
echo "</table>";
///////////////////////////////////// 
4

1 回答 1

0

这可以帮助你...

if( isset($_POST['zoneid']) ){

    $zoneID = $_POST['zoneid'];
    //Your extra code or processing here.
}

$q=mysql_query("select r.*, f.Functionname,  m.Managername, z.Zonename from requests as r  inner join functions as f on r.functionID = f.functionID inner join managers as m on r.managerID = m.managerID inner join zones as z on r.zoneID = z.zoneID where Status='A' and     z.zoneID=1 order by Functionname");


echo "<table>
<tr>
<th>Function</th>
<th>Manager</th>
</tr>"
;

// Here we create a form
echo "<form method='post' >";
echo "<Search for ZoneID: <input type='number' name='zoneid' /><br>";
echo "<input type='submit' value='search' />";
echo "</form>";
while($nt=mysql_fetch_array($q)){
echo"<b>Zone: ".$nt['Zonename']."<br>Capacity: ".$nt['Zonecapacity']."</b><br><br>";
echo "<tr><td>$nt[Functionname]</td><td>$nt[Managername]</td></tr>";
}
echo "</table>";

?>
于 2013-05-03T06:27:44.873 回答