我在 page1 中有一个表单.php里面有一些复选框:
<form method="POST" action="page2.php">
<input type="checkbox" name="F10">
<input type="checkbox" name="W10">
<input type="checkbox" name="F20">
<input type="checkbox" name="W20">
<input type="checkbox" name="F30">
<input type="checkbox" name="W30">
<input type="checkbox" name="F11">
<input type="checkbox" name="W11">
<input type="checkbox" name="F21">
<input type="checkbox" name="W21">
<input type="checkbox" name="F31">
<input type="checkbox" name="W31">
<input type="checkbox" name="F12">
<input type="checkbox" name="W12">
<input type="checkbox" name="F22">
<input type="checkbox" name="W22">
<input type="checkbox" name="F32">
<input type="checkbox" name="W32">
</form>
页2.php
<?php
$g=0;
$coursesD= array();
for($f=1;$f++;$f<4){
for($l=0;$l++;$l<3){
if(isset($_POST["F".$f.$l])){
$coursesD[$g]=$_POST["F".$f.$l];
$g++;
}
if(isset($_POST["W".$f.$l])){
$coursesD[$g]=$_POST["W".$f.$l];
$g++;
}
}
}
?>
但是在我提交表单后,它开始加载,然后显示以下消息:
致命错误:超过 30 秒的最大执行时间 C:''xampp''htdocs''4''page2.php 在第 5 行
请帮助我
你for
循环的顺序错误
它应该是
for(starting condition;loop condition;after each loop){
你的最后 2 个顺序错误,所以 F++ 是真的,因此将永远循环(并导致超时)