|
Posted by Carl on 12/29/05 02:50
Sunny wrote:
> Hi
>
> In a form I use a multiple selection section.
>
> <select name="Xes" multiple><option
> name="some_indexed_id">some_text</option>
>
> How can I retrieve all the choices made in that <select> ?
>
> $_POST["Xes"] only gives one value even if I choose many.
>
>
> Thanks
>
>
Sunny,
I think you want your from to look more like this:
<select name="Xes[]" multiple>
<option value="1">some_text</option>
<option value="2" >other_text</option>
<option value="3">more_text</option>
</select>
Notice that only the select tag has the name property, and the options
only have value properties. Also, notice the '[]' at the end of the
select name property value.
After submitting this form, check the value of $_POST['Xes']( or
$_GET['Xes'] if your form action is "get"), which will contain an array
of the values selected.
Hope that helps,
Carl.
Navigation:
[Reply to this message]
|