This is your Combobox, which as you mention you have no problem filling
My.html
<select data-no-selected="Sin Seleccionar" id="tuid" name="tuid" required class="form-control></select>
In a JS file, in this part when the file loads, what you put in your Load will be executed, example:
Here you can fill in your Combobox
Mi.JS
$("#micombo").load("llenarcombo.php");
But what does llenacombo.php contain?
$orden=mysqli_query($cn,"select * from tutabla");
echo '<option value="">Seleccione el Registro</option>';
while($datos=mysqli_fetch_array($orden))
{
echo '<option value="'.$datos['id'].'">'.$datos['nombre'].' </option>';
}
As you mention it when you change the selection of your combo, you should send the variable this is thanks to the "Change" event, this variable is collected in your php
$("document").ready(function()
{
$("#tuid").change(function(){
var id2=$("#tuid").val();
$.get("tuphp.php",{parametro:id2})
.done(function(data){
$("#mostraren").html(data);
})
})
}
But what does your php.php contain?
$param=$_GET["parametro"];
include('conexion.php');
$orden=mysqli_query($cn,"select * from tabla2 where id=$param");
echo '<option value="">Seleccione Cedula</option>';
while($datos=mysqli_fetch_array($orden))
{
echo '<option value="'.$datos['id'].'">'.$datos['nombre'].'</option>';
}
Y To insert Data?
In this part you receive the parameters that you sent through JS
$param=$_GET["parametro"];
$param1=$_GET["parametro1"];
$orden=mysqli_query($cn,"INSERT INTO tabla2 (dato1,dato2) values param=$param1 where id=$param");
echo "Datos Insertado";