0
I am following a video of php with mysql and I am able to list the data of a table in a list (list), just so you know that the problem of connection with the database is already overcome. I tried to use the same code to list the same table in a combobox, and it is not filling. The combo appears, but it does not fill in with the data. Does anyone know where I’m going wrong? Follow code:
<body>
<ul>
<?php
// Passo 4 - Listagem dos dados
while($registro = mysqli_fetch_assoc($categorias)){
?>
<li><?php echo $registro ["nomecategoria"]?></li>
<?php
}
?>
</ul>
<form name="produto" method="post" action="">
<label for="">Selecione um produto</label>
<select>
<option>Selecione...</option>
<?php
while($registro = mysqli_fetch_assoc($categorias)) { ?>
<option = "<?php echo $registro['categoriaID'] ?>"><?php echo $registro["nomecategoria"] ?></option>
<?php } ?>
</select>
</form>
<?php
//Passo 5 - Liberar dados da memória
mysqli_free_result($categorias);
?>
</body>
Put all the code so that it is possible to analyze the question better
– José Gomes
Put your query query to the bank as well, so you want us to resolve how?
– Anderson Henrique
Welcome Neto Sales, be sure to read this post https://pt.meta.stackoverflow.com/questions/1078/como-e-por-que-aceitar-uma-resposta/1079#1079
– user60252