Re: Using PHP to get all items in a multi-select form field
| From: | Chuck dot Hirstius at walgreens dot com | Date: | Wed, 03 Jan 2001 17:15:43 +0000 |
| Subject: | Re: Using PHP to get all items in a multi-select form field | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-32523@lists.php.net to get a copy of this message | ||
>>On Wed, 3 Jan 2001 Chuck.Hirstius@walgreens.com wrote:
>>
>> I am trying to a "SELECT" element in a form, and I am allowing multiple
>> selections. However when I try to retrieve the values PHP only returns
the
>> last selected value. I found that adding "[]" to the end of my
element's
>> name fixes the problem (PHP then gets an array) but I am using several
>> JavaScript functions to validate, and alter the selections. Adding the
>> brackets breaks all of the JavaScript. Can anyone give me a way to make
>> both of these work? To still be able to use JavaScript (ie have a
normal
>> name) and yet get all of the selections from the box.
>>
>> I am currently off list, so please respond to my email address. Thanks!
>>
>> Chuck Hirstius
>>
>
>Use document.someform["someoption[]"]. It's a little-known fact that
>attributes can be treated like elements of an associative array.
>
>--
>Ignacio Vazquez-Abrams <ignacio@openservices.net>
That did it, thank you! Problem solved.
Chuck