-1
I have some combobox in the area of editing user information and I need to pull the data already selected previously by the user at registration time. I tried to do with the foreach but it didn’t work.
<div class="form-group col-md-5" >
<label for="inputSexo">Sexo</label>
<select name="sexo_cliente" id="sexo_cliente" class="form-control" disabled>
<option selected disabled="">Sexo</option>
<?php
require_once "api/conexao.php";
try {
$prepared3 = $conexao_pdo->prepare("select * from sexo");
$prepared3->execute();
$result3 = $prepared3->fetchAll();
foreach($result3 as $resultado3) {
echo "<option value='". $resultado3["cod"] ."'>". $resultado3["sexo"] ."</option>";
}
} catch (PDOException $e) {
echo "<option></option>";
}
?>
</select>
</div>
I imagine that this variable is filled with the attribute of the user who is trying to edit...
– Darlei Fernando Zillmer
I got it, thank you very much!!
– Nathi