Forum Moderators: coopster

Message Too Old, No Replies

How would you get values from a from a multiple <select> input?

         

smithaa02

2:17 pm on Jul 11, 2006 (gmt 0)

10+ Year Member



I allow my select input to have the 'multiple attribute, how do I obtain the variables it sends using PHP?

ChadSEO

2:34 pm on Jul 11, 2006 (gmt 0)

10+ Year Member



smithaa02,

If you add square brackets to the end of the name of the <select>, then it will be passed over as an array. For instance, the following select:

<select multiple="yes" name="myinputs[]">

Would be accessible without the squarebrackets in the name, like this:

An Array => $_POST['myinputs']
First Element => $_POST['myinputs'][0]

Chad