If one generates a form with bootstrap
and bootstrap-select
:
<form action="handle.php" method="post">
<select name="pids" class="selectpicker" multiple>
<option value="1">A</option>
<option value="2">B</option>
<option value="6">C</option>
</select>
</form>
And one select all or multiple items, only the item with the last selected value
is posted to the handle.php
page.
handle.php
<?php
var_dump($_POST);
?>
result:
array(1) { ["pids"]=> string(1) "6" }
how can one retrieve all selected items?
Its most likely a case that you need to set the name to pids[] (note the square brackets) The square brackets define an array instead of a single value.
<select name="pids[]" class="selectpicker" multiple>