此foreach生成选项列表。从列表中选择任何选项时,它仅传递来自上一个可用选项的数据,而不传递用户选择的数据。 我知道它不是干净的或安全的,所以在那里不用担心。 。 。(一次一步。。。)我只需要它传递所选项目的数据,而不是始终传递选择列表中的最后一个。
<?php foreach ($result as $row) : ?>
<form action="selected-results.php" type="get">
<tr>
<td><input type="text" name="offnum" value="<?php echo escape($row["offnum"]); ?>" size="11" readonly></td>
<td><input type="text" name="offdesc" value="<?php echo escape($row["offdesc"]); ?>" size="20" readonly></td>
<td><input type="text" name="stafn" value="<?php echo escape($row["stafn"]); ?>" size="10" readonly></td>
<td><input type="text" name="staln" value="<?php echo escape($row["staln"]); ?>" size="10" readonly></td>
<td><input type="text" name="slots" value="<?php echo escape($row["slots"]); ?>" size="3" readonly></td>
<td><input type="text" name="olitaclvl" value="<?php echo escape($row["olitaclvl"]); ?>" size="1" readonly></td>
<td><input type="text" name="omathaclvl" value="<?php echo escape($row["omathaclvl"]); ?>" size="1" readonly></td>
<td><input type="text" name="stuid" value="<?php echo "$stuid"; ?>" size="5" readonly></td>
<td><input type="text" name="stufn" value="<?php echo "$stufn"; ?>" size="10" readonly></td>
<td><input type="text" name="stuln" value="<?php echo "$stuln"; ?>" size="10" readonly></td>
<td><input type="submit" value="Select"></td>
</tr>
<?php endforeach; ?>
我认为通过将每个选择单独放在一个表单中将使它传递来自特定表单(选择)的数据,但事实并非如此。无论用户选择哪个,它始终会通过列表中的最后一个选择。从数据库中读取选项中的数据,并显示在选项列表中。用户在每个选择的末尾使用“选择”按钮单击他们的选择。
感谢您的任何见解。
我已经尝试过<form action="selected-results.php" type="post">
,但是那也不起作用。