473,320 Members | 1,988 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

group check boxes not in array?

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>
Nov 2 '08 #1
3 2307
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>
Nov 2 '08 #2
rf

<st***********@gmail.comwrote in message
news:d2**********************************@u29g2000 pro.googlegroups.com...
On Nov 2, 1:20 am, Michael Vilain <vil...@NOspamcop.netwrote:
if(is_array($_POST["$test"]))
if(is_array($_POST["test"]))
Nov 2 '08 #3
On Sun, 2 Nov 2008 00:10:54 -0700 (PDT), st***********@gmail.com
wrote:

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

--
Curtis
$email = str_replace('sig.invalid', 'gmail.com', $from);
Nov 2 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Adrian Parker | last post by:
I have a PHP generated page which displays X many records. Each record has a checkbox preceding it. The user checks several checkboxes, and hits a delete button. All the corresponding records...
2
by: Edward | last post by:
The following html / javascript code produces a simple form with check boxes. There is also a checkbox that 'checks all' form checkboxes hotmail style: <html> <head> <title></title> </head>...
1
by: Jim in Arizona | last post by:
I'm having dificulty figuring out how to process multiple check boxes on a web form. Let's say I have three check boxes: cbox1 cbox2 cbox3 The only way I can think of to code the...
5
by: | last post by:
I use several mutually exclusive radio boxes (with a group box). How can I easily test which one is checked, do I need to do a multiple if or case statement to check all of them one by one, or is...
2
by: cpptutor2000 | last post by:
Could some PHP guru please help me? I have very standard PHP - MySQL application that reads in some data from a table and for each row, puts a check box at the start of the row. Now the check boxes...
2
by: birwin | last post by:
I found a Javascript snippet that very effectively checks all boxes on a page, even on a page on which the input tags are in tables and on which I use a lot of other javascript. Unfortunately it is...
5
by: zacks | last post by:
I am having a strange issue with an application written in .NET 2.0. Actually it is in VB.NET but I think my problem is not language specific, but a .NET Framework issue. On a form I have a...
2
beacon
by: beacon | last post by:
Hi everybody, I have a form that has a combo box that asks the user to select the program they work on. Once the user selects the program, a SQL statement populates the row source for 4 staff...
1
by: ghjk | last post by:
my php page has 7 check boxes. I stored checked values to database and retrive as binary values. This is the result array Array ( => 0 => 1 => 0 => 1 => 0 => 0 => 1 ) 1 means checked....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.