php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23197 $_POST / $_GET incorrect
Submitted: 2003-04-14 03:35 UTC Modified: 2003-04-14 09:04 UTC
From: Guus-Leeu at gmx dot de Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.2RC1 OS: Linux 2.4.18
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Guus-Leeu at gmx dot de
New email:
PHP Version: OS:

 

 [2003-04-14 03:35 UTC] Guus-Leeu at gmx dot de
Setup of PHP4.3.2.RC1 (CVS copy of that branch) 
./configure --with-apxs=/usr/local/apache/bin/apxs --with-openssl 
--with-ldap=/usr/local/openldap --enable-mysql 
--with-mysql=/usr/local/mysql --prefix=/usr/local/php4_cvs 
 
Suppose I have 
<form action="my.php" method="post"> 
<select name="preferredLanguage" multiple> 
<option value="1">English</option> 
<option value="2">German</option> 
<option value="3">Dutch</option> 
</select> 
</form> 
 
Suppose, the user selects German and Dutch by CTRLclicking 
the entries. 
 
The array $_POST ends up having 
$_POST["preferredLanguage"] == "3" 
rather than 
$_POST["preferredLanguage"][0] == "2" && 
$_POST["preferredLanguage"][1] == "3" 
 
The $_QUERY_STRING (if using method="GET") contains both 
values, but the $_GET array is not set correctly. 
 
I suppose, this has to do with the fact that values are just 
registered one after the other, as is the case in 
php_std_post_handler(), whereas it would be nice to have a 
prelookup if the key already exists and then build an array for its 
value. 
 
I'm not sure where I can fix this, but if you give me the right 
pointers, I'm sure able to do it myself. 
I'ld suggest building an array for the key's value that has: 
["count"] number of elements 
[0] first value 
[1] second value 
etc. 
 
Or did I miss something in my compilation? 
 
Cheers, 
Guus 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-14 09:04 UTC] rasmus@php.net
Use:
<select name="preferredLanguage[]" multiple>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 06:01:31 2024 UTC