1
I have a modal that performs email sending. Only I created some email templates in the database mysql. On the screen appears my select with all the templates for selection, only that I would like when the model is selected, it fills the input "subject matter" and the textarea "content" with the information coming from the database.
Below follows my own 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 that this process should be done with jquery and Ajax making a request on a page PHP, but I don’t know how I’d do it that way.
Thank you very much DVD
– Robson Freitas