主题:复选框的提交数据问题~!谢谢了~
表单内容:
<form><label>
<input type="checkbox" name="a[]" value="电脑" />
</label>
电脑</p>
<p>
<label>
<input type="checkbox" name="a[]" value="美术" />
美术</label>
</p>
<p>
<label>
<input type="checkbox" name="a[]" value="数学" />
数学</label>
<br />
</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</p>
</form>
----------------
show.php:
<?php
if(!empty($_POST['a']))
foreach($_POST['a'] as $b)
echo"你的爱好是:";
echo $b."<br>";
?>
显示以下错误:
Warning: Invalid argument supplied for foreach() in D:\php\show.php on line 1
Notice: Undefined variable: b in D:\php\show.php on line
为什么????????????????
<form><label>
<input type="checkbox" name="a[]" value="电脑" />
</label>
电脑</p>
<p>
<label>
<input type="checkbox" name="a[]" value="美术" />
美术</label>
</p>
<p>
<label>
<input type="checkbox" name="a[]" value="数学" />
数学</label>
<br />
</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</p>
</form>
----------------
show.php:
<?php
if(!empty($_POST['a']))
foreach($_POST['a'] as $b)
echo"你的爱好是:";
echo $b."<br>";
?>
显示以下错误:
Warning: Invalid argument supplied for foreach() in D:\php\show.php on line 1
Notice: Undefined variable: b in D:\php\show.php on line
为什么????????????????