I have the following table that shows a list of data inserted in it:
Career Table:
To show them in the form I use the following function:
function bd_carrera_opciones()
{
$sql = "SELECT carr_id,carr FROM carrera ORDER BY carr ASC";
$res = sql2options( $sql );
$zz=array();
$zz['--']='--- Seleccione la Carrera ---';
foreach($res as $id=>$valor)
{
$zz[$id]=$valor;
}
return $zz;
}
showing up like this:
works perfectly, I use this script:
carr_id: {
required: true,
range: [1, 99]
},
to prevent the chosen value from being
'--- Seleccione la Carrera ---'
THE PROBLEM:
I would like a default value to appear is to say something like this:
I do not know how to do it
Method to show the races:
<div class="form-group">
<label for="esta_proy_id" class="control-label col-lg-2"><font size=3 color="red">*</font>Estado del Proyecto: </label>
<div class="col-lg-5">
<select class="form-control" name="esta_proy_id" id="esta_proy_id">
<?php foreach($proyecto_estado as $i=>$proyecto_estado_temp):?>
<option value="<?=$i?>"><?=$proyecto_estado_temp?></option>
<?php endforeach; ?>
</select>
</div>
</div>
BY INSERTING THE FUNCTION OF EDUARDO FUENTES: