I have a modal that does email sending. But I created some email templates in the mysql database. On the screen appears my select with all templates for selection, only I would like when the template is selected, it filled in the input subject "and the textarea " content " with the information coming from the database.
Below is my HTML with select using PHP :
<div class="form-group m-form__group row">
<div class="col-lg-6">
<label for="recipient-name" class="form-control-label">Assunto:</label>
<input type="text" class="form-control limpar" id="assunto">
</div>
<div class="col-lg-6">
<label for="recipient-name" class="form-control-label">Modelo:</label>
<select class="form-control m-input limpar" id="select_acao" name="id_atividade_tipo">
<option>Selecione</option>
<?php
$sql_modelo = $db->prepare("SELECT * from modelo_email");
$sql_modelo->execute(); $atv = 0 ;
while($row_modelo=$sql_modelo->fetch(PDO:: FETCH_ASSOC)){
$atv++; ?>
<option value="<?php echo $row_modelo['id']?>">
<?php echo utf8_encode($row_modelo['nome'])?>
</option>
<?php }?>
</select>
</div>
</div>
<div class="form-group m-form__group row">
<textarea class="summernote" id="conteudo" name="conteudo">
<br/>
</textarea>
</div>
I believe this process should be done with jquery and Ajax by requesting a PHP page, but I do not know how I would do it that way.