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

<selectname="data[]"multiple="multiple" ><optionvalue="1">a</option><optionvalue="2">b</option><optionvalue="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?"