Re: PHP 4.0 Bug #8240: <select ... multiple> useless
| From: | Ignacio Vazquez-Abrams | Date: | Wed, 13 Dec 2000 21:07:20 +0000 |
| Subject: | Re: PHP 4.0 Bug #8240: <select ... multiple> useless | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-41220@lists.php.net to get a copy of this message | ||
On 13 Dec 2000 joel@qulit.com wrote:
> From: joel@qulit.com
> Operating system: Linux 2.4.0-test11
> PHP version: 4.0.3pl1
> PHP Bug Type: Feature/Change Request
> Bug description: <select ... multiple> useless
>
> In the following example PHP would return just the last element of the selected options.
>
> <html>
> <form action="<?php print $PHP_SELF; ?>" method="post">
> <select name="test" multiple>
> <option>abc
> <option>def
> <option>ghi
> </select>
> </form>
> </html>
> <?php
> var_dump ( $test );
> ?>
>
> If method="get" is used, then the problem can be solved by manually interpreting the
> global variable $QUERY_STRING. But if you use the post method, then I can't see how it's
> possible to use <select>'s multiple attribut.
>
> One nice solution would be if PHP could return the variable as an array automatically. No
> problems with backwards compatiblity would occur since the multiple attribut has been impossible to
> use anyway.
> But to be sure noone will run into problems, maybe you guys could make it an option in php.ini?
> (That is, to automatically create an array if a value is sent to the script several times via GET or
> POST.)
>
> I'm really stuck here, since <select multiple> is the only solution to my problems,
> and using the GET method is out of question. It's just too lame.
>
> Thanks in advance for any advice or comments.
>
Try:
<select name="test[]" multiple>
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>