php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #24344 $_POST to create an array when name is repeated
Submitted: 2003-06-26 08:32 UTC Modified: 2003-06-26 08:34 UTC
From: tjedmunds at yahoo dot com Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.3.2 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
22 - 2 = ?
Subscribe to this entry?

 
 [2003-06-26 08:32 UTC] tjedmunds at yahoo dot com
Description:
------------
It would be very useful if PHP would automatically create an array for $_POST when the same input field name occurs multiple times in a POST'ed form.  This can be accomplished by putting [] after the name in the form but that is not always an option for every application (such as wrapping a Perl cgi or writing a 'remote' browser).  $HTTP_RAW_POST_DATA is more useful but is not always populated without php.ini file changes.  The result is that the default behaviour is to discarded POST'ed data as it is overwritten with the last value.

It would be preferable to have the following:
  $_POST[nonuniquename][0] = "the first occurence";
  $_POST[nonuniquename][1] = "the second occurence";
  ...
  $_POST[nonuniquename][n] = "the nth occurence";

instead of:
  $_POST[nonuniquename] = "the nth occurence";




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-26 08:34 UTC] derick@php.net
We can not do this because it would break BC for users who rely on PHP using the last value set for a specific variable name. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 01:01:28 2024 UTC