How To Get Values Of Multiple Select In PHP

As we all know Multiple Select in HTML is a Select box where we can choose multiple values.

While define multiple select by adding multiple=”multiple” like the example below –


But when we will submit data, even after choosing multiple values, $_POST will show only one entry. To get all the values we need to change the name from sel to sel[]. This will result in showing all the chosen values in $_POST like below –

[sel] => Array
(
[0] => 1
[1] => 2
)

Leave a comment

Your email address will not be published. Required fields are marked *