php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22626 POST'ing an Array (<input name="checkbox[70]">) gives string 'Array'
Submitted: 2003-03-10 13:17 UTC Modified: 2003-03-10 17:31 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: cyborg at driverheaven dot net Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5CVS-2003-03-10 (dev) OS: Windows 2003 Server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cyborg at driverheaven dot net
New email:
PHP Version: OS:

 

 [2003-03-10 13:17 UTC] cyborg at driverheaven dot net
when posting information through a form, using an array for a name, example:

4 inputs: <input name="checkbox[70]" type="checkbox" />

(where 70 is different for each input, according to the messageid)

PHP gives the value 'Array' for $_POST['checkbox'], and it is a string, as print_r() displays 'Array', and is_array() returns false on check.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-10 14:07 UTC] derick@php.net
Please show us the script in which you do the print_r().

Derick
 [2003-03-10 17:09 UTC] cyborg at driverheaven dot net
It appears to have been my problem, as I wasn't checking for whether the variable was an array or string, and attempting to stripslashes() if magic_quotes_gpc was enabled.

/me smacks head for being an idiot.

(Although there was no problems with it on PHP >= 4.1.0)
 [2003-03-10 17:15 UTC] sniper@php.net
Not PHP bug -> bogus.

 [2003-03-10 17:31 UTC] cyborg at driverheaven dot net
indeed.
 [2003-05-13 13:51 UTC] rajc at aol dot com
I need to know how to use an array of checkboxes and find out if these checkboxes are on or off.  cyborg  will you please post your code.

Here is how i am creating my checkboxes.
$tmps =	getforumtemplates();
			
if(!is_array($tmps))
{
print "<br><br>Their are no templates defined. If you would like to enter one please click on Add New link.\n";
?>
<br>		
<?php
}//end if
else
{ $number = 0;
$arr = array();
			print "Template Name:<br>";
			foreach($tmps as $t)
			{?>	<input type="checkbox" name="templates[]"> <?=$t->name?><font size = "-1">
																	<a href="modifyforumtemplates.php?tid=<?=$t->templateid?>">modify</a></font><br>
			<?php 
			
				$number++;
			}
			//end foreach
			
		}
		//end else
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Dec 16 06:00:02 2025 UTC