php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23260 Form input array problem
Submitted: 2003-04-17 09:53 UTC Modified: 2003-04-17 22:00 UTC
From: tah at NebrWesleyan dot edu Assigned:
Status: Closed Package: Apache2 related
PHP Version: 4.3.1 OS: Solaris
Private report: No CVE-ID: None
 [2003-04-17 09:53 UTC] tah at NebrWesleyan dot edu
I seem to be getting a malformed array from input check boxes.  If more than one checkbox is selected the array contains extra entries or invalid data.  This problem seems to be platform dependent. I'm running apache 2.0.45 on a Solaris 9 sparc system.  This does not appear to be a problem with the same versions of php and apache on a redhat linux intel system.  However it does appear to happen on a Macintosh running Yellowdog linux.

My configure line for php looks like this.

'./configure' '--with-mysql' '--with-ldap' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-gd' '--with-lib-jpeg' '--enable-ftp' '--with-zlib-dir=/usr/local/lib'

Here is a short script that I have used to reproduce the problem.  If you run the script,  select a couple of check boxes and then click the test button, it prints out the array and you can see the extra or invalid data.  It also appears that is the form method is changed from post to get the problem goes away.

<?php
if($_REQUEST['test'])
{
   print "<html><head></head><body>\n";
   
   print "Size of \$_REQUEST: ". count($_REQUEST)."<br>\n";
   print "Size of \$_REQUEST['mylist']: ". count($_REQUEST['mylist'])."<br>\n";
   print "Contents of the \$_REQUEST['mylist'] array:<br><br>\n";
   for($i=0 ; $i < count($_REQUEST['mylist']) ; $i++)
     {
       print "$i: ".$_REQUEST['mylist'][$i]. "<br>\n";
     }
   
   print "</body></html>\n";
}
else
{
  print "<html><head></head><body>\n";
  print "<form action=$PHP_SELF method=post>\n";
  print "<input type=checkbox name=mylist[] value=1>checkbox 1<br>\n";
  print "<input type=checkbox name=mylist[] value=2>checkbox 2<br>\n";
  print "<input type=checkbox name=mylist[] value=3>checkbox 3<br>\n";
  print "<input type=checkbox name=mylist[] value=4>checkbox 4<br>\n";
  print "<input type=hidden name=test value=1>\n";
  print "<input type=submit value=Test>\n";
  print "</form>\n";
  print "</body></html>\n";
}
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-17 10:45 UTC] moriyoshi@php.net
1. read bug #18648
2. try 4.3.2RC1

 [2003-04-17 13:54 UTC] tah at NebrWesleyan dot edu
Version 4.3.2RC1 seems to fix the problem.  Thanks.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 09:00:02 2026 UTC