Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <select name="ttl" required>
- <?php
- $tglLahir = 05; // misalkan tgl nya 05
- for($tgl=1; $tgl<=31; $tgl++){
- /*
- if($tgl<=9) { echo "<option value='0$tgl'>0$tgl</option>"; }
- else { echo "<option value='$tgl'>$tgl</option>"; }
- echo "<option selected='selected' value='$tglLahir'>$tglLahir</option>";
- */
- $tmp= "<option %s value='%s'>%02s</option>";
- $selected= (int)$tglLahir==$tgl?'selected':'';
- $val=$title=$tgl;
- printf($tmp, $selected, $val, $title);
- }
- ?>
- </select>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement