#25262 [Bgs]: Nested arrays in POST not processed correctly
| From: | jal at ambitonline dot com | Date: | Tue, 26 Aug 2003 21:35:31 +0000 |
| Subject: | #25262 [Bgs]: Nested arrays in POST not processed correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-46716@lists.php.net to get a copy of this message | ||
ID: 25262
User updated by: jal at ambitonline dot com
Reported By: jal at ambitonline dot com
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Windows 2000
PHP Version: 4.3.3
New Comment:
DOH. Brain failure. Sorry.
Previous Comments:
------------------------------------------------------------------------
[2003-08-26 16:31:53] pollita@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
The form you provided in reproduce code is invalid. Please read the
PHP net manual section on arrays again.
Try something like this:
<form action="strtest2.php" method="post">
<input name="myObject[myVar]" size="40"><br>
<input name="myObject[myArray][0]" size="40"><br>
<input name="myObject[myArray][1]" size="40"><br>
<input type="submit" value="go">
</form>
------------------------------------------------------------------------
[2003-08-26 16:20:54] jal at ambitonline dot com
Description:
------------
Nested arrays in a HTML form are not parsed out correctly.
Reproduce code:
---------------
strtest1.php:
<form action="strtest2.php" method="post">
<input name="myObject[myVar]" size="40"><br>
<input name="myObject[myArray[0]]" size="40"><br>
<input name="myObject[myArray[1]]" size="40"><br>
<input type="submit" value="go">
</form>
strtest2.php:
<?php
print_r($_POST);
?>
Expected result:
----------------
Array ( [myObject] => Array ( [myVar] => text1 myArray => Array([0] =>
text2 [1] => text3 ) ) )
Actual result:
--------------
Array ( [myObject] => Array ( [myVar] => text1 [myArray[0] => text2
[myArray[1] => text3 ) )
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25262&edit=1