SHOW:
|
|
- or go back to the newest paste.
1 | <select name="bln" required> | |
2 | ||
3 | <?php | |
4 | $blnLahir = 'Maret'; // misalkan bulan nya 8= | |
5 | $bln=array(1=>"Januari","Februari","Maret","April","Mei","Juni","July","Agustus","September","Oktober","November","Desember"); | |
6 | for($bulan=1; $bulan<=12; $bulan++){ | |
7 | $tmp= "<option %s value='%s'>%02s</option>"; | |
8 | - | $selected= (int)$blnLahir[$bulan]==$bln[$bulan]?'selected':''; // Bingung di sini |
8 | + | //$selected= (int)$blnLahir[$bulan]==$bln[$bulan]?'selected':''; // Bingung di sini |
9 | $selected= strtolower($blnLahir) == strtolower($bln[$bulan])?'selected':''; | |
10 | $title=$bln[$bulan]; | |
11 | $val=$title; | |
12 | printf($tmp, $selected, $val, $title); | |
13 | } | |
14 | ||
15 | // $bln=array(1=>"Januari","Februari","Maret","April","Mei","Juni","July","Agustus","September","Oktober","November","Desember"); | |
16 | // for($bulan=1; $bulan<=12; $bulan++){ | |
17 | // echo "<option value='$bln[$bulan]'>$bln[$bulan]</option>"; | |
18 | ?> | |
19 | </select> |