此 php 代码创建一个表格,该表格的每一行都有一个“书”按钮。
我想从单击“book”到另一个表单(在“restricted.php”中)的行中获取“phase”和“site”的值来预订站点。(目前所有行都通过点击书提交)
<?php
$phase=$_GET["q"];
$sql ="select id, phase,size, facing, sply, status from plot where status='avail' and phase='$phase'";
$ret=mysql_query($sql, $connect);
echo "<form action='restricted.php' method='get'>";
echo"<div style='overflow-y:scroll;height:200px;float:left;' ><table border=1 >
<tr>
<td>select </td><td>phase</td> <td>site no.</td> <td>plot-size</td> <td>face</td> <td>sply</td> <td>status</td>
</tr>" ;
while($row = mysql_fetch_array($ret, MYSQL_ASSOC))
{
echo "<tr>".
"<td><input type='submit' name='book' value='book' onClick=\"whichForm('send_to_one');\" /></td>".
"<td><input type='text' value=\"{$row['phase']}\" name='phase' size='3' readonly /> </td>".
"<td><input type='text' value=\"{$row['id']}\" name='site' size='4' readonly /></td>".
"<td> {$row['size']} </td>".
"<td> {$row['facing']} </td>".
"<td>{$row['sply']} </td> ".
"<td>{$row['status']} </td> ".
"</tr>";
}
echo "</table></div>";
mysql_close($connect);
?>