I have a multiple bootstrap select from which I'm using Select2 (Multiple select boxes) . When you select more than one value, the first value of the select always appears without selecting it. See the code:
$multiplo = ($tipo == "Escolas")?("multiple='multiple'"):(null);
$visualizar = "<select name=\"Modulos[]\" class=\"form-control select2\" ".$multiplo." data-placeholder=\"Selecione o módulo\" style=\"width: 100%;\">";
while($jm = mysqli_fetch_object($sql)){
$visualizar .= "<option value='".$jm->id_serie."'>".$jm->nome_serie."</option>";
}
$visualizar .= "</select>";
I'm rescuing using the foreach:
$modulos = $_POST['Modulos'];
foreach($series as $escolhaSeries){
echo $escolhaSeries."<br>"
}
Would anyone have any idea why this occurs?