Ex:
<body>
<?php
include("conexa.php");
$id = 80;
$pegadiv = $PDO->query("SELECT * FROM 'dividas' WHERE id_user = '$id'");
while($linha = $pegadiv->fetch(PDO::FETCH_ASSOC)){
$idConta = $linha['id'];
$nomeConta = $linha['descricao'];
echo "<br>";
}
?>
<form method="post" action="action.php">
<select name="conta">
<option name="<?php $idConta ?>"> <?php echo $nomeConta?> </option>
</select>
<input type="submit" value="Excluir">
</form>
</body>
This is the way I'm doing, except that only the last account listed by the user appears.