0
I’m using the Materialize library, taking the database data and listing in front-end, but the multiple selection does not work:
<div class="row">
<form action="#">
<span>
<?
$sql = "SELECT * from $ufEstab where cidade = '{$cidadeEstab}' group by bairro";
$query = mysqli_query($conexao,$sql);
while ( $ln = mysqli_fetch_array($query)) {?>
<div class="col s4">
<input value="<?= utf8_encode($ln['bairro']);?>" type="checkbox" name="bairro" id="test5" />
<label for="test5"><?= utf8_encode($ln['bairro']);?></label>
</div>
<? }//fim do while bairros ?>
</span>
<button class="btn">Cadastrar bairros</button>
</form>
</div><!--row-->
I think you should use a select with the Multiple attribute. <select Multiple> <option value="" disabled Selected>Choose your option</option> <option value="1">Option 1</option> <option value="2">Option 2</option> <option value="3">Option 3</option> </select>
– Rafael Ferreira
Might explain better what’s not working ?
– Duque
It does, except that you are ordering PHP to define all checkboxes with the same value in name (neighborhood), so when sending the form, one element will overwrite the other so that it only looks like a single element.
– Clayderson Ferreira