Good afternoon!
I'm making an order form.
This select, I get the design of the BIFOCALES family We say that you save the ID of the design, so that it can be hooked later with the ID (If or if I have to work with the IDs)
<select name="bif_oi" onchange="this.form.submit()">
<option value="0" disabled selected>Seleccione diseño </opcion>
<?php
/* creamos la consulta */
$result=mysqli_query($link, "SELECT * FROM disenyos where id_familia = 8;");
/* utilizamos un ciclo repetitivo para obtener los datos de la tabla */
while ($valores = mysqli_fetch_array($result)) {
/* preguntamos si es el seleccionado por el usuario */
if (isset($_POST['bif_oi'])){
if($valores['id_disenyo']==$_POST['bif_oi']){
?>
<!-- Llenamos el select con lo seleccionado por el usuario -->
<!-- Agrego el id del diseño como valor del campo -->
<option value="<?php echo $valores['id_disenyo'] ?>"selected> <?php echo $valores['nombre']; ?> </option>
<?php
}
else {
?>
<!-- Llenamos el select con los datos de la tabla -->
<!-- Agrego el id del diseño como valor del campo -->
<option value="<?php echo $valores['id_disenyo'] ?>"> <?php echo $valores['nombre']; ?> </option>
<?php
} /* cierre del else $valores*/
} /* cierre del if del isset */
else {
?>
<!-- Llenamos el select con los datos de la tabla -->
<!-- Agrego el id del diseño como valor del campo -->
<option value="<?php echo $valores['id_disenyo'] ?>"> <?php echo $valores['nombre']; ?> </option>
<?php
} /* cierre del else del isset*/
} /* cierre del while */
?>
</select>
The problem, that when you put this in the INPUT, you do not get the name, you get the value from the ID How can I make it show the NAME, and not the ID?
Inside this input:
<input type="text" name="lenteoi" value="<?php echo $_POST["bif_oi"]; ?>"/>
I would greatly appreciate some kind of solution or proposal. Thank you very much and greetings! :)