#23260 [Opn->Fbk]: Form input array problem

From: Date: Thu, 17 Apr 2003 15:45:18 +0000
Subject: #23260 [Opn->Fbk]: Form input array problem
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37817@lists.php.net to get a copy of this message
ID: 23260 Updated by: moriyoshi@php.net Reported By: tah at NebrWesleyan dot edu -Status: Open +Status: Feedback Bug Type: Apache2 related Operating System: Solaris PHP Version: 4.3.1 New Comment: 1. read bug #18648 2. try 4.3.2RC1 Previous Comments: ------------------------------------------------------------------------ [2003-04-17 09:53:26] 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"; } ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23260&edit=1

« previous php.bugs (#37817) next »