I have the following problem: I have a dropdown (which has as values the id's of a table of my bank) and I would like, after making the selection of one of the items of this, data related to it (present in the bank) , fill in the input values on the same page. Could someone help me?
<div class="modal fade" id="modalEventoEdit" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"> <i class="fas fa-pen"></i> Editar evento</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form method="POST" action="cadasevento.php">
<div class="modal-body">
<?php
$id_adm = $_SESSION['id_adm'];
$sql = "SELECT * FROM tb_evento WHERE id_adm = $id_adm ORDER BY data_inicio";
$r_evento = $con->query($sql);
?>
<select name="c" class="form-control" id="c">
<option>Escolha o evento</option>
<?php
while($row_evento = $r_evento->fetch_assoc()){
?>
<option value="<?php echo $row_evento['id'];?>">
<?php
echo $row_evento['titulo'];
?></option>
<?php
}
?>
</select>
</div>
<div class="modal-footer">
<button class="btn btn-outline-success" type="submit">Enviar</button>
</div>
</form>
</div>
</div>
</div>
Everything must occur within this modal, where after selecting the option
input fields are filled with the selection data.