I'm currently testing with PHP 4.3.1 as an Apache module. The pattern I normally follow is to lump all form fields together into a single array and then perform processing against the array. However, nested array do not seem to be importing correctly.
Forms A and B pass values to handler.php as I would expect. Form C does not. I detail my expectations below...
Form A:
<form action=handler.php>
<input type="hidden" name="test[first]" value="1">
<input type="hidden" name="test[second]" value="2">
<input type="submit" name="Submit" value="Submit">
</form>
Form B:
<form action=handler.php>
<input type="hidden" name="test[]" value="1">
<input type="hidden" name="test[]" value="2">
<input type="submit" name="Submit" value="Submit">
</form>
Form C:
<form action=handler.php>
<input type="hidden" name="outer[test[]]" value="1">
<input type="hidden" name="outer[test[]]" value="2">
<input type="submit" name="Submit" value="Submit">
</form>
Form A produces something like:
$_REQUEST['test'] = array('first' => 1, 'second' => 2);
Form B produces something like:
$_REQUEST['test'] = array(1, 2);
Form C was expected to produce something like:
$_REQUEST['outer'] = array('test' => array(1, 2));
Instead it produced something like this:
$_REQUEST['test'] = array('test[' => 2);
This seems like a bug to me. Does anyone know which (if any) versions of PHP handle this correctly, or where I can go to file a bug report?
PS:
These forms are a simplified version of the forms I'm really working with. The behavior with something this simple may not be quite the same. I would try to produce tested simple versions before filing a real bug report.
Passing nested arrays to $_REQUEST
Moderator: General Moderators
try
Code: Select all
<!-- Form C: -->
<form action="handler.php" method="POST"><!-- or method="GET" which is default -->
<input type="hidden" name="outerїtest]ї]" value="1" />
<input type="hidden" name="outerїtest]ї]" value="2" />
<input type="submit" name="Submit" value="Submit" />
</form>