I'm starting now in the area and I have a college job to do and it's necessary to use the MVC standard, I've even separated things well, but I came across the following code in a file from my view layer >, the filename is novoAtendimento.php
(name is suggestive).
In the following code, I have a <select>
field in HTML and the <option>
of it is generated according to the information we have in the database, if we add 1 value in the database, that value will appear in% and if we remove it from the database, this value will disappear from <option>
, the code is working right, I just wonder if it's right to do that.
<div class="col-xs-4">
<div class="form-group">
<label for="tipoAtendimento">Tipo do Atendimento:</label>
<?php
$tipoAt = new TipoAtendimentoController();
$retornoTipoAt = $tipoAt->select();
if(count($retornoTipoAt) > 0)
{
echo "<select class=".'selectpicker'." data-size=".'5'." data-live-search=".'true'." data-width=".'100%'.">";
foreach ($retornoTipoAt as $dados => $value)
{
echo "<option data-subtext=".$retornoTipoAt[$dados]->id_GAPtipoatendimento.">".$retornoTipoAt[$dados]->nome_GAPtipoatendimento."</option>";
}
echo "</select>";
}
else
{
header("Location: erro.php");
}
?>
</div>
</div>