Date: 11/23/00
- Next message: sniper <email protected>: "[PHP-DEV] PHP 4.0 Bug #7932 Updated: dbmnextkey not working properly"
- Previous message: Stanislav Malyshev: "Re: [PHP-DEV] Big Function Lists"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 7934
Updated by: sniper
Reported By: bzeeb+php <email protected>
Status: Closed
Bug Type: Variables related
Assigned To:
Comments:
Just add [] to the name. i.e.
<input type="checkbox" name="FORM_key[]" value="2">
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2000-11-22 17:03:47] bzeeb+php <email protected>
Using p.ex. function from FAQ 7.1 to read HTTP_POST_VARS one
is unable to handle/see all key-value-pairs when key is the same for
multiple values. I did not find any way to see all pairs (well one might define an array as name but that is not what CGI standard expects I think).
p.ex. having something like this in a HTML form:
<input type=checkbox name="FORM_key" value="2">
<input type=checkbox name="FORM_key" value="8">
<input type=checkbox name="FORM_key" value="19">
would only result in:
FORM_key -> 19
sizeof($HTTP_POST_VRS) = 1
instead of
FORM_key -> 2
FORM_key -> 8
FORM_key -> 19
where sizeof would return 3.
This is most likely caused by using some kind of associative array instead
of using indexes. I did not manage to solve this by using other array f()s.
I do not have time to look at the source code - sorry.
A simple dirty quick hack perl-script shows you that one does get all the
three values:
--- snipp ---
#!/usr/bin/perl
printf("Content-Type: text/htmlnn");
if ($ENV{'CONTENT_LENGTH'} > 0) {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
<email protected> = split(/&/, $buffer);
printf("nPOST-Buffer (raw):<br>n");
printf("%sn", $buffer);
printf("nPOST-Buffer (split up):<br>n");
foreach $pair ( <email protected>) {
printf("%s<br>n", $pair);
}
} else {
printf("NO HTTP_POST_VARs -> nothing to do here<br>n");
}
# End;
--- snipp ---
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7934
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: sniper <email protected>: "[PHP-DEV] PHP 4.0 Bug #7932 Updated: dbmnextkey not working properly"
- Previous message: Stanislav Malyshev: "Re: [PHP-DEV] Big Function Lists"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

