Page 1 of 1

Getting multiple values from List Box

Posted: Wed Sep 07, 2005 2:23 am
by eshban
Hi,

I have a one LIST BOX , in which a user has option to select multiple values. I want that if user select 3 values from LIST BOX, then my program print all these three values on the submission of the form

plz help me in in the code

bye

Posted: Wed Sep 07, 2005 2:28 am
by feyd

Code: Select all

<select name="multiselectbox[]" multiple="multiple">
.....
</select>
I believe that's all you'd absolutely require.. (not tested)

the principle behind it: when php sees brackets in a form field name it creates an array. Using an empty (or always unique) value between the brackets will linearly store all fields passed under the parent name. To see what I mean, print_r($_POST['multiselectbox']) with several selections made..

(again, untested)