ID: 46288
Updated by: [EMAIL PROTECTED]
Reported By: rveetil at google dot com
-Status: Open
+Status: Feedback
-Bug Type: Arrays related
+Bug Type: Apache2 related
Operating System: Windows XP
PHP Version: 5.2.6
New Comment:
This simplified test works fine for me:
<pre>
<?php
var_dump($_POST);
?>
</pre>
<form method="POST" action="t.php">
<select name="test[]" multiple >
<option value="A"> Option A</option>
<option value="B"> Option B</option>
<option value="C"> Option C</option>
<option value="D"> Option D</option>
</select>
<input type="submit" name="submit">
</form>
Note: I'm using CGI, not the Apache SAPI module.
Previous Comments:
------------------------------------------------------------------------
[2008-10-14 03:08:19] rveetil at google dot com
Description:
------------
My configuration is Window XP/Apache 6.0.14/PHP 5.2.6. Browser tested-
IE6, FireFox 3.0, Google Chrome
The multiple select of the form variable always returns a single value
in an array (always returns the top one in the list).
Pick options: Option A
Option B
Option C
Option D
I've selected Option B, Option C & Option D
Reproduce code:
---------------
<?php
if ($_POST) {
echo '<pre>';
echo htmlspecialchars(print_r($_POST, true));
echo '</pre>';
}
$test=$_POST['test'];
if ($test){
foreach ($test as $t){echo 'You selected :',$t,'<br />';}
}
?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Pick options:
<select name="test[]" multiple >
<option value="A"> Option A</option>
<option value="B"> Option B</option>
<option value="C"> Option C</option>
<option value="D"> Option D</option>
</select>
<input type="submit" name="submit">
</form>
Expected result:
----------------
Array
(
[test] => Array
(
[0] => B
[1] => C
[2] => D
)
[submit] => Submit Query
)
You selected :B
You selected :C
You selected :D
Actual result:
--------------
Array
(
[test] => Array
(
[0] => B
)
[submit] => Submit Query
)
You selected :B
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46288&edit=1