Advertisement
GWibisono

isenk aja mas

Aug 4th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1.  <select name="ttl" required>
  2.  
  3. <?php
  4. $tglLahir = 05; // misalkan tgl nya 05
  5. for($tgl=1; $tgl<=31; $tgl++){
  6. /*
  7. if($tgl<=9) { echo "<option value='0$tgl'>0$tgl</option>"; }
  8. else { echo "<option value='$tgl'>$tgl</option>"; }
  9.  
  10. echo "<option selected='selected' value='$tglLahir'>$tglLahir</option>";
  11. */
  12. $tmp= "<option %s value='%s'>%02s</option>";
  13. $selected= (int)$tglLahir==$tgl?'selected':'';
  14. $val=$title=$tgl;
  15.     printf($tmp, $selected, $val, $title);
  16. }
  17.  
  18. ?>
  19.  
  20. </select>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement