I have a form that has a select name="nome_cliente"
field that retrieves all registered clients from the mysql database.
In this same form I have several inputs that will be registered to that selected client, and have a textarea name="evolucao"
that is readyonly because in this textarea I want to return from the database the evolution already registered of this client so that it is registering new information already know what has been registered evolution.
I would like to know how I would do this, since it will have to be with jquery from the nome_cliente
that has already been selected in the dropdown and load this information into a textarea.
Follow the code
<div class="col-md-12">
<div class="col-md-10 titulo">Adicionar sessões para Pacientes Cadastrados
</div>
<div id="adicionar">
<form name="form1" action="<?php echo raiz?>servicosbd/adicionaragenda.php" method="POST">
<div class="col-md-6 item">
<div class="texto">
Paciente:
</div>
<select name="nome_cliente" id="" required>
<option value="">Escolha o paciente</option>
<?php
$query = "select 'id','nome' from 'clientes' order by nome asc";
$result = $mysqli->query($query);
$num_results = $result->num_rows;
if($num_results > 0){
while ($row = $result->fetch_assoc()) {
$id_cliente = $row['id'];
$nome_cliente = $row['nome'];
if(!empty($nome_cliente)){
?>
<option value="<?php echo $nome_cliente; ?>"><?php echo $nome_cliente; ?></option>
<?php
}
}
}
?>
</select>
<?php if(!empty($id_cliente)){ ?>
<input type="hidden" name="id_cliente" value="<?php echo $id_cliente; ?>">
<?php } ?>
</div>
<div class="col-md-12">
<div class="texto">
Evoluções Anteriores:
</div>
<textarea name="evolucao" rows="5" readonly style="background: #C1C1C1;color: #000000">
AQUI QUE TEM QUE RETORNAR OS DADOS
</textarea>