$.ajax({
dataType : 'json',
type : 'POST',
url : 'consulta_datos.php',
data :{id_principal},
async:true,
cache:false,
success : function(response){
var id=response.id;
var identificacion=response.identi;
var nombre_completo=response.nom_compl;
$("#id").val(id);
$("#identificacion").val(identificacion);
$("#nombre_completo").val(nombre_completo);
},
error : function(error) {
console.log(error);
}
});
Well I recommend you use jQuery to make your Ajax to return the query data, when you create your table in the button that opens your modal, send a function that you will do in a javascript in this function that you do to send the parameter that I imagine is the id of your table you do your query and you put it in a JSON from PHP, and on the JavaScript side you receive it, and with Jquery send the values to the corresponding input, the previous code is A brief example of how you could start.