I am creating a form to update data, I bring the information from the table escolar
called T1 to update it, and another table ge_jornada
called T2 that does not has relation with T1, I genre again the options for a dropdown, which already shows the saved day, and must show the alternative options that are in T2 .
Table 1 = school = T1
id | alumno | acudiente | direccion | tarifa | placa | jornada |
------------------------------------------------------------------
1 | juan | Maria | Calle 107 | $80.000 | TTY521 | A |
------------------------------------------------------------------
2 | pablo | Lina | Calle 47 | $90.000 | TTY521 | B |
Table 2 = ge_jornada = T2 this table is to build the dropdown
id | jornada |
--------------
1 | A |
--------------
2 | B |
--------------
3 | Unica |
I'm trying to get the data like this:
$con = mysqli_connect("*****", "user", "***", "BD") or die("Error " . mysqli_error($con));
$query_edit = "SELECT t1.* FROM escolar as t1 WHERE t1.id='$editid' AND t1.placa = '$placa_id'
CROSS JOIN SELECT t2.jornada AS jos FROM ge_jornada as t2";
$edit = mysqli_query( $con, $query_edit );
$row = mysqli_fetch_row($edit);
My PHP form to update
<form class="form-horizontal" method="POST" action="actualizar.php" autocomplete="off">
<input type="text" class="form-control" id="direccion" name="direccion" placeholder="Direccion" value="<?php echo $row['t1.direccion']; ?>" required>
<select id="jornada" class="js-select js-select-3" name="jornada" required>
<option value="<?php echo $row['t1.jornada']; ?>"><?php echo $row['t1.jornada']; ?></option>
<?php while ($row=mysqli_fetch_array($edit)) {
echo '<option value='.$row["t1.id"].'>'.$row["t2.jos"].'</option>';
} mysqli_free_result($edit) ?>
</select>
...
But I can not get the information to update, it does not load any data.
Thanks for the help I'm an apprentice.