|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-04-17 10:45 UTC] moriyoshi@php.net
[2003-04-17 13:54 UTC] tah at NebrWesleyan dot edu
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 10:00:01 2026 UTC |
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"; } ?>