0
Good afternoon friends! I have a modal with a city edit form that carries data coming from a JSON. Everything works. The problem now is that mine does not select the correct state. My JSON returns the state ID that I assign to an Hidden input. I do not know how to put this value in . Can help me ?
<div class="col-md-12">
<input hidden id="hdIdCidade"/>
<input hidden id="hdEstado"/>
<select name="estados" id="estados" class="form-control" style="width:400px;">
<?php
$select = $conexao->prepare("SELECT * FROM estados ORDER BY nome ASC");
$select->execute();
$fetchAll = $select->fetchAll();
foreach ($fetchAll as $estados) {
echo '<option value="' . $estados['id'] . '">' . $estados['nome'] . '</option>';
}
?>
</select>
</div>
I’ll try here Gabriel. Thank you very much.
– Vinicius Avanzi