I have a accounts payable screen, and when I edit the data, the option field is showing the name of the supplier ( Liquigas ), so far so good. But when I click on the list, the vendor's name is appearing twice. What can I do wrong?
<div class="form-group col-md-10">
<label>Fornecedor</label>
<select class="form-control form-control-sm" name="cod_for">
<?php
$sql_nome_for = "SELECT nome FROM cad_for WHERE id = '$cod_fornecedor'";
$sql_nome_for = $pdo->query($sql_nome_for);
$dado_for = $sql_nome_for->fetch();
?>
<option><?php echo utf8_encode($dado_for['nome']); ?></option>
<?php
$sql_for = "SELECT id, nome FROM cad_for WHERE del <> '1' ORDER BY nome";
$sql_for = $pdo->query($sql_for);
If($sql_for->rowCount()>0){
foreach($sql_for as $fornecedor):
?>
<option value="<?php echo $dado['id_cad_for']; ?>" ><?php echo utf8_encode($fornecedor['nome']); ?></option>
<?php
endforeach;
}
?>
</select>
</div>