Getting multiple values from List Box

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

Getting multiple values from List Box

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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)
Post Reply