0
由于某种原因,总是收到以下错误提供参数无效:未定义指数&为的foreach()+形式
- 未定义的索引:除去在第5行
- 提供的foreach无效的参数()第6行
你有什么想法我做错了吗?
谢谢:)
<html>
<body>
<?php
if(isset($_POST['remove_yes'])){
echo $_POST['remove'];
foreach($_POST['remove'] as $item){
echo ('You have just removed location id: '.$item . '<br />');
}
}
elseif(isset($_POST['remove_no'])){
echo 'No data removed!';
}
?>
<form method="post">
<input type="submit" class="button" name="submit_remove" value="Remove">
<input type="checkbox" name="remove[a]">
<input type="checkbox" name="remove[b]">
</form>
<?php
if(isset($_POST['submit_remove'])){ //confirmation
?>
<form method="post">
<table>
<tr>
<th>Do you want to really remove data?</th>
</tr>
<tr>
<td><input type="submit" value = "Yes" name = "remove_yes"></td>
<td><input type ="submit" value = "No" name="remove_no"></td>
</tr>
</table>
</form>
<?php
}
?>
</body>
</html>
'$ _ POST [ '删除']'是一个数组 – devpro
是的,它应该是成为 –
因为你有两种不同的形式。 –