-1
Hello,
I have the following function that returns me the necessary data to popular my dropdown:
function listaRedes($conexao){
$dados = array();
$resultado = mysqli_query($conexao, "SELECT DISTINCT rede FROM evolucao_originacao");
while($valores = mysqli_fetch_array($resultado)){
array_push($dados, $valores);
}
return $dados;
};
And in my dropdown, I’m making the following code:
<?php $redesBanco = listaRedes($conexão); ?>
<div class="form-group">
<select class="form-control" id="dropdown-parceria">
<option value="0">---SELECIONE---</option>
<?php
while($redesBanco){
echo "<option value='".$redesBanco."'>".$redesBanco."</option>";
}
?>
</select>
</div>
But as soon as he populates my dropdown, the result is this::
When Voce does the while you’re still iterating under arrays, try to see what’s inside the com array
var_dump($redesBanco)
,– RFL
@Rafaelacioly the array is with all the data I searched from the database.
– João Vitor
The
var_dump
is to see the structure of yourarray
.– Augusto