vinitha
asked on
Value from a Multiple Select
Hi,
how can get the values from a select having multiple items selected.
<select name="t" multiple>
<option value=1>name1</option>
<option value=2>name2</option>
<option value=3>name3</option>
<option value=4>name4</option>
</select>
when i try to post the form the $_post['t'] returns only the last index e.g if name2 and name3 are selected ; only name3 is returned.
help asap.
regards,
vinitha
how can get the values from a select having multiple items selected.
<select name="t" multiple>
<option value=1>name1</option>
<option value=2>name2</option>
<option value=3>name3</option>
<option value=4>name4</option>
</select>
when i try to post the form the $_post['t'] returns only the last index e.g if name2 and name3 are selected ; only name3 is returned.
help asap.
regards,
vinitha
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
now when u will post the form u will get all the selected values in this array, which u can access it like this
echo $t[0]; //value selected 1
echo $t[1]; //value selected 2
echo $t[2]; //value selected 3
This works as I have checked.
--------------------------
<select name="t[]" multiple>
<option value=1>name1</option>
<option value=2>name2</option>
<option value=3>name3</option>
<option value=4>name4</option>
</select>
--------------------------
Hope this will solve your problem