0
我真的想知道set_select
代碼選擇字段。我已經嘗試了很多方法,但不起作用。set_value代碼選擇字段選項
我有一個變量這裏$date_dossier = date_parse($patient['patient_date_dossier']);
但它並沒有定義如下功能:
<?php echo form_error('dossier_day') ?>
<?php
$option_day = array(
'01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05', '06' => '06', '07' => '07',
'08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14',
'15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20', '21' => '21',
'22' => '22', '23' => '23', '24' => '24', '25' => '25', '26' => '26', '27' => '27',
'28' => '28', '29' => '29', '30' => '30', '31' => '31'
);
echo'<select name="dossier_day" class="form" id="day">';
for ($a = 1; $a <= 31; $a++) {
?>
<option value="<?php echo $a < 10 ? '0' . $a : $a ?>">
<?php if($a==$date_dossier['day']){
echo 'selected='.'"'.$a.'"';
}?>
<?php echo $a < 10 ? '0' . $a : $a ?></option>
<?php
}
echo'</select>'; echo '<span style="color:red">'.form_error('dossier_day').'</span>'
?>