Connecting Tech Pros Worldwide Help | Site Map

group check boxes not in array?

student4lifer@gmail.com
Guest
 
Posts: n/a
#1: Nov 2 '08
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>
student4lifer@gmail.com
Guest
 
Posts: n/a
#2: Nov 2 '08

re: group check boxes not in array?


On Nov 2, 1:20*am, Michael Vilain <vil...@NOspamcop.netwrote:
Quote:
In article
<2ebc6523-fd15-4082-975f-f957eed97...@b38g2000prf.googlegroups.com>,
>
>
>
>
>
*student4li...@gmail.com wrote:
Quote:
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.
>
Quote:
==========
>
Quote:
<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
>
Quote:
</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>
rf
Guest
 
Posts: n/a
#3: Nov 2 '08

re: group check boxes not in array?



<student4lifer@gmail.comwrote in message
news:d2abbcd7-d32f-456c-8d86-4a326045b5d0@u29g2000pro.googlegroups.com...
On Nov 2, 1:20 am, Michael Vilain <vil...@NOspamcop.netwrote:
Quote:
if(is_array($_POST["$test"]))
if(is_array($_POST["test"]))


Curtis
Guest
 
Posts: n/a
#4: Nov 2 '08

re: group check boxes not in array?


On Sun, 2 Nov 2008 00:10:54 -0700 (PDT), student4lifer@gmail.com
wrote:

[snip]
Quote:
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.
>
[snip]
Quote:
<form action="self.php">
<form action="self.php" method="post">

--
Curtis
$email = str_replace('sig.invalid', 'gmail.com', $from);
Closed Thread