|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-11-01 21:04 UTC] jani@php.net
[2008-11-09 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 17:00:02 2025 UTC |
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