Skip to content Skip to sidebar Skip to footer

How To Get All Values Of Multiple Select Box Through POST?

I need to get all(Selected and unselected) the values of a multiple select box through POST. How can I do the trick?

Solution 1:

Create a select tag like this

<select name="data[]" multiple="multiple" >
    <option value="1">a</option>
    <option value="2">b</option>
    <option value="3">c</option>
</select>

You can get the selected values:

foreach ($_GET['data'] as $selected) {
    echo $selected."\n";
}

You can not get the unselected values.


Post a Comment for "How To Get All Values Of Multiple Select Box Through POST?"