You can solve this with ajax, if you have done the so famous fields select "State X Municipality", follows the same reasoning.
Clicking on the button will trigger an event that will have an ajax that will point to a php file, where you will take the parameter and mount the specific query and return the database data.
// cadastrarPaciente.js
$("#uf").on("change", function(){
$.get("modulos/pacientes/ajax_listarCidade.php",
{uf: $("#uf").val()},
function(dados){
$("#cod_cidade").empty();
$("#cod_cidade").append(dados);
});
});
// ajax_listarCidade.php
$PArray['uf'] = $_REQUEST['uf'];
$sql = "SELECT cod_mun, nome_mun FROM TMunicipio WHERE uf = '{$PArray['uf']}'";
...
Just follow this line of thought.
Your question is too wide yet, have you made any attempt to do this? Have the table structure already done? Do you already have a model of how this would work? We need more details to give you a good answer. To improve your question you can edict-la
– Erlon Charles
Yeah, I got it. The form works perfectly, I just can’t think of how to load the template into the input when the user clicks (Load Template), that this template is a ready text only.
– user10307
I think it would make it easier to answer if you edited the question to include the relevant code snippets of what you already have ready.
– dang