4
I’m starting now in the area and I have a college job to do and it is necessary to use the MVC standard, I have even separated things well, but I came across the following code in a file of my layer view, the file name is novoAtendimento.php
(name is suggestive).
In the following code, I have a field <select>
in HTML and the <option>
of it are generated according to the information we have in the database, if we add 1 value in the database, this value will appear in the <option>
and if we remove it from the bank, that amount will disappear from <option>
, the code is working right, I just wonder if it’s right to do this.
<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>
I agree, some doubts about the standard can be clarified at: http://www.php-fig.org/psr/
– teliz