2 回答

TA贡献1887条经验 获得超5个赞
您可以将复选框元素的名称定义为数组,并将 as 值传递。bookingID
示例(未经测试):
$output = "<tr><td>{$row['bookingID']}</td><td>{$row['firstName']}</td><td>{$row['surname']}</td><td><input type='checkbox' name='present[]' value='{$row['bookingID']}'</td><td><input type='checkbox' name='incident[]' value='{$row['bookingID']}'</td></tr>";
然后包含一个数组,其中包含所选复选框的 ID。$_POST['present']
$_POST['incident']

TA贡献1911条经验 获得超7个赞
如果将其更改为“则”再次提交数据时,将在其中获得一个值数组,而不是单个值数组。(您将在数组中为每个具有实际选中该名称的复选框获得一个项目 - HTML表单的一个怪癖是,如果未选中该复选框,则根本不会提交其值)。name='present[]'$_POST["present"]
您还需要将复选框的 更改为客户(或预订,可能)的 ID,以便您可以确定选中了哪个框。value
当然,“事件”复选框也是如此。
所以你的目标是这样的东西,我想:
echo "<tr>
<td>".$row['bookingID']."</td>
<td>".$row['firstName']."</td>
<td>".$row['surname']."</td>
<td><input type='checkbox' name='present[]' value='".$row['bookingID']."'</td>
<td><input type='checkbox' name='incident[]' value='".$row['bookingID']."'</td>
</tr>";
- 2 回答
- 0 关注
- 120 浏览
添加回答
举报