#23260 [NEW]: Form input array problem
| From: | tah at NebrWesleyan dot edu | Date: | Thu, 17 Apr 2003 14:53:26 +0000 |
| Subject: | #23260 [NEW]: Form input array problem | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-37814@lists.php.net to get a copy of this message | ||
From: tah at NebrWesleyan dot edu
Operating system: Solaris
PHP version: 4.3.1
PHP Bug Type: Apache2 related
Bug description: Form input array problem
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 bug report at http://bugs.php.net/?id=23260&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23260&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23260&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23260&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23260&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23260&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23260&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23260&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23260&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23260&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23260&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23260&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23260&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23260&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23260&r=gnused