I have a form with a dropdown
, which should have as options the users registered in a table of my database.
The connection:
<?php
$connection = mysqli_connect("localhost", "root", "", "db_formacao");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
The form:
<!-- Content -->
<?php
require 'conn.php';
$query = mysqli_query("SELECT NOME FROM colaboradores");
?>
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h1 style="
margin-top:100px;">Inscrição</h1>
<p> </p>
<p class="lead"></p>
<ul class="list-unstyled">
<form id="cadastro" method="post" action="banco/updateP.php" style="
text-align: left;
margin-top:50px;">
<div class="col-lg-12">
<div class="form-group" style="
text-align: left;">
<label for="FORMACAO">Formação: </label>
<input type="text" required class="form-control" id="FORMACAO" name="FORMACAO" value="<?=$row['nome']?>">
</div>
</div>
<div class="col-lg-12">
<div class="form-group" method="post" style="
text-align: left;">
<label for="TURMA">Turma: </label>
<input type="text" required class="form-control" id="TURMA" name="TURMA">
</div>
</div>
<div class="col-lg-12">
<div class="form-group" method="post" style="
text-align: left;">
<label for="COLABORADOR">Colaborador: </label>
<select class="form-control" id="COLABORADOR" name="COLABORADOR">
<option>Selecione...</option>
<?php while($colab = mysql_fetch_array($query)) { ?>
<option value="<?php echo $colab['NOME']; ?>"><?php echo $colab['NOME']; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="col-lg-12">
<div class="form-group" method="post" style="
text-align: left;">
<label for="PREVISTO">Status: </label>
<input type="text" required class="form-control" id="PREVISTO" name="PREVISTO" value="Previsto">
</div>
<div class="form-check form-check-inline disabled">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="STATUS" id="STATUS" value="Realizado" disabled> Realizado
</label>
</div>
<div class="">
<button type="submit" class="btn btn-primary btn-lg btn-block">Salvar</button>
</div>
</div>
</form>
</ul>
</div>
</div>
</div>
The options simply do not appear. Can someone point me where the error is?