Re: Multiple Selections?
| From: | Sean Cazzell | Date: | Sun, 13 May 2001 23:48:25 +0000 |
| Subject: | Re: Multiple Selections? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52640@lists.php.net to get a copy of this message | ||
> I have a Multiple Selection HTML Field --- the user can select any number of
> items by holding down the CTRL key. When I submit my form to my (say)
> TestProg.php -- in the Hidden Input Field I only see the value for the
> *last* item I selected... how can I see all the items I selected?
If you want to allow the user to select multiple items, you should append
'[]' to the end of the name of your select.
<select name="color[]" size="3" multiple>
Now when you get the value, it will be an array of the items they
selected.
You may run into a problem with your hidden input type on the second page
- I'm not sure how PHP will handle things because your value will now be
an array. You may want to write out a hidden field for each of the users
selections - like:
<input type="hidden" name="color[]" value="one">
<input type="hidden" name="color[]" value="two">
<input type="hidden" name="color[]" value="three">
Regards,
Sean
On Sun, 13 May 2001, Jason Caldwell wrote:
>
> Thanks.
> Jason
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>