Posts

Showing posts with the label dropdown

Select option with info from database

Select option with info from database I'm trying to show up in a select, multiple options that are in the table on database. $query_lista = sqlsrv_query($conn, "SELECT * FROM inquerito"); while ($query_lista1 = sqlsrv_fetch_array($query_lista)) { $nome=$query_lista1["nome_inquerito"]; $ativo=$query_lista1["ativo"]; $id_inquerito=$query_lista1["id_inquerito"]; echo "<select>"; echo "<option>$nome</option>"; echo "</select>"; So this code above is functional, but present multiple selects, it's possible that show just one select and inside present all the infos from nome_inquerito on database. Thanks. wrap the while loop code inside select – v Sugumar 4 mins ago ...