1
I have a form that has a select field name="nome_cliente"
retrieving all registered clients from the mysql database.
in this same form I have several inputs that will be registered to that selected client, and has a textarea name="evolucao"
that this as readyonly because in this textarea I want to return from the database the already registered evolution of that client so that it is registering new information already know what has registered evolution.
I would like to know how to do that, because 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.
Follows 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>
thank you so much for the code snippet was exactly what I needed, with the call of the evolution variable within the select gave sure my code. TKS
– Alex Sousa
You are welcome to vote for the answer, thank you.
– arllondias