Reputation: 5107
I am using the following code in a html form to select values from a database:
<p><strong>PRIMERA OPCION</strong>:
<p>POR FAVOR, SELECCIONE UN ELEMENTO DE ENTRE LOS SIGUIENTES:
<select name="opcion1_linea" id="opcion1_linea">
<?php
do {
?>
<option value="<?php echo $row_Recordset11['plato_seleccionado']?>" ><?php echo $row_Recordset11['nombre_plato']." ( + ".money_format('%i', $row_Recordset11['sobreprecio_opcion']).")" ?></option>
<?php
} while ($row_Recordset11 = mysql_fetch_assoc($Recordset11));
?>
</select>
At this moment, the values are shown, but I want that the first option to be shown should be the text "No needed" and the value to be stored should be 0. How could I implement my need?
Upvotes: 0
Views: 1115
Reputation: 539
<p><strong>PRIMERA OPCION</strong>:
<p>POR FAVOR, SELECCIONE UN ELEMENTO DE ENTRE LOS SIGUIENTES:
<select name="opcion1_linea" id="opcion1_linea">
<option value="0">No es necesario</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset11['plato_seleccionado']?>" ><?php echo $row_Recordset11['nombre_plato']." ( + ".money_format('%i', $row_Recordset11['sobreprecio_opcion']).")" ?></option>
<?php
} while ($row_Recordset11 = mysql_fetch_assoc($Recordset11));
?>
</select>
That do it for ya?
Upvotes: 2
Reputation: 1246
Just add in a hard coded value?
<select name="opcion1_linea" id="opcion1_linea">
<option value="0">Not Applicable</option>
<?php do { ?>
Upvotes: 1