php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25474 posting arrays from a select box with multiple select is not working properly
Submitted: 2003-09-10 14:30 UTC Modified: 2003-09-23 23:22 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: fmuller at cisco dot com Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 4.3.3 OS: redhat 7.3
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: fmuller at cisco dot com
New email:
PHP Version: OS:

 

 [2003-09-10 14:30 UTC] fmuller at cisco dot com
Description:
------------
Red Hat 7.3/Apache 2.0/PHP 4.3.3.

If I select multiple selections on a select box,
with an array name,
with a form method of post

I do not get the array of selected values I expect.

If one option is selected it works fine.  
If I use a method of get it works fine.

Here is what phpinfo.php displays when I select 1 and 2:

_REQUEST["param"]	

Array
(
    [0] => 1
    [1] => 2param[]=1
    [2] => 2
)

_POST["param"]	

Array
(
    [0] => 1
    [1] => 2param[]=1
    [2] => 2
)

Reproduce code:
---------------
<html>
<body>
<form method=post action=phpinfo.php>
<select name="param[]" multiple size=6>
<option value=0>0</option>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
</select>
<input type=submit>
</form>
</body>
</html>

------------------

phpinfo.php
<?
phpinfo();
?>

Expected result:
----------------
_REQUEST["param"]	

Array
(
    [0] => 1
    [1] => 2
)

_POST["param"]	

Array
(
    [0] => 1
    [1] => 2
)



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-10 20:18 UTC] sniper@php.net
Works fine for me. How did you configure PHP? 
How did you configure PHP for Apache2?

Add this line to your test script:

echo $HTTP_RAW_POST_DATA;

And set "always_populate_raw_post_data" php.ini option to 'On'. Then post the result here.

 [2003-09-11 07:25 UTC] fmuller at cisco dot com
Here is what the raw post data looks like:

param%5B%5D=1&param%5B%5D=2param%5B%5D=1&param%5B%5D=2

Here is my configure info:  Need more?

 Command 	 './configure' 'i386-redhat-linux' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-pcre=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-pear=/usr/share' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=/usr' '--with-mysql=/usr' '--with-oci8=/opt/oracle/product/9.2' '--with-mssql' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-apxs2filter=/usr/sbin/apxs'

Additional info: 
  Things also work fine if my action is a perl cgi-bin script:

content_length = 27
stdin = param%5B%5D=1&param%5B%5D=2
 [2003-09-23 09:31 UTC] sniper@php.net
Instead of using --with-apache2filter, use --with-apxs2, which enables the apache2handler version. Please let us know if that works.

 [2003-09-23 09:33 UTC] moriyoshi@php.net
See bug #18648.

That's caused by the configuration error.

 [2003-09-23 23:22 UTC] fmuller at cisco dot com
Yes, I agree this bug is bogus.  I was able to reconfigure httpd.conf as suggested in 18648, and fix the problem.

I simply commented out the following as suggested from the 
Redhat sample httpd.conf file, and restarted apache.

#<Files *.php>
#    SetOutputFilter PHP
#    SetInputFilter PHP
#    LimitRequestBody 524288
#</Files>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Sep 29 00:01:26 2024 UTC