Thank you very much to the community in advance.
good to the matter, I have created a simple dynamic select option that when selecting a client in the next select option your pets come out.
Here I charge the clients in the first select option.
<label for="inputEmail1" required class="col-lg-2 control-label">Paciente:</label>
<select id="id_paciente" name="id_paciente" class="form-control" onchange="MostrarMascota()">
<option value="" selected disabled>---SELECCIONE---</option>
<?php
$salx=mysql_query("SELECT * FROM pacientes ");
while($col=mysql_fetch_array($salx)){
echo '<option value="'.$col['id'].'">'.$col['nombre'].'</option>';
}
?>
and the one for pets is the following code:
</select>
<br>
<label for="inputEmail1" required class="col-lg-2 control-label">Mascotas:</label>
<div id="div_mascot">
<select name="mascotas" type=text id="mascotas" autocomplete="off" class="form-control" required>
<option value=""></option>
</select>
</div>
<br>
To get the client's pets out I had to make another php that performs the respective query with the id already obtained by a get.
This would be the code that I mention:
<select name="mascotas" id="mascotas" class="form-control">
<option value="">- Seleccione Mascota -</option>
<?php
include '/conexion.php';
$IdEspe = $_POST['id'];
$sql = "select mascotas.id, mascotas.nombre from mascotas where idpaciente= $IdEspe";
$result = $mysqli->query($sql);
while( $row = $result->fetch_assoc())
{
$idcitass=$row['id'];
?>
<option value="<?php echo $row['id']."~".$row['nombre'] ?>" ><?php echo $row['nombre']; ?></option>
<?php
$valor=explode("~",$_POST["mascotas"]);
$clase=$valor[0];
$clase2=$valor[1];
}
?>
</select>
a select option was made that has two variables per value separated by the sign ~. The problem I have is that when wanting to manipulate the variables $ class and $ class2 to the other php by means of an include "combomascota.php"; I get an error on the page and I have no idea how to get those two variables in the other php.