2 回答
TA贡献1801条经验 获得超16个赞
您在第一页中的表单不包含表单操作,因此您必须将表单操作放到第二页,然后可以从第二页捕获发布的数据。
//我的第一页
<form method="POST" action="mysecondpage.php">
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Price</th>
<th>Check</th>
</tr>
</thead>
<?php
if(mysqli_num_rows($result)>0){
$i=1;
while($row=mysqli_fetch_array($result))
{
echo'<tr>
<td>'.$row['id'].'</td>
<td>'.$row['name'].'</td>
<td>'.$row['price'].'</td>
<td><input type="checkbox" name="check[]" value='.$row['id'].'></td>
';
$i++;
}
}
?>
</table>
<input type="submit" name="submit" Value="Submit"/>
</form>
TA贡献1875条经验 获得超5个赞
起初 vardump 这个$_POST['check']
。它是数组吗,您的代码可以工作。通过 vardump 变量,您可以找到解决方案。
您可以与我分享您的 vardump 结果。
- 2 回答
- 0 关注
- 123 浏览
添加回答
举报