On Nov 2, 1:20*am, Michael Vilain <vil...@NOspamcop.netwrote:
In article
<2ebc6523-fd15-4082-975f-f957eed97...@b38g2000prf.googlegroups.com>,
*student4li...@gmail.com wrote:
I thought the group check boxes would be parsed as an array, but the
code below didn't print out as I expected. Could someone explain what
I am missing? Thanks.
==========
<html>
<body>
<input name="test[]" type="checkbox" value="1" checked="true"one
<input name="test[]" type="checkbox" value="2" checked="true"two
<input name="test[]" type="checkbox" value="3"three
</body>
<?php
if(is_array($_POST['$test']))
{
foreach ($_POST["test"] as $t) {
echo $t."<br />";
}
}
?>
</html>
The web page doesn't report the checkbox control unless they're set on
the page. *If they're unclicked, they aren't reported to php in a POST.
--
DeeDee, don't press that button! *DeeDee! *NO! *Dee...
[I filter all Goggle Groups posts, so any reply may be automatically by ignored]- Hide quoted text -
- Show quoted text -
Thanks for your answer. I modified the code as the followings and
checked all 3 boxes prior to hitting submit to self-submit the form,
but it still returned blank. What am I missing again? Thanks.
<html>
<body>
<form action="self.php">
<input name="test[]" type="checkbox" value="1"one
<input name="test[]" type="checkbox" value="2" checked="true"two
<input name="test[]" type="checkbox" value="3"three
<?php
if(is_array($_POST["$test"]))
{
foreach ($_POST["test"] as $t) {
echo $t."<br />";
}
}
?>
<input name="Submit" type="submit" value="submit">
</form>
</body>
</html>