PHP month days options


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function getDayOptions( $selected )
  2. {
  3. $options = '';
  4.  
  5. for( $x = 1; $x < 32; $x++ )
  6. {
  7. if( strlen( $x ) == 1 ) $x = '0' . $x;
  8.  
  9. $options .= '<option value="' . $x . '"';
  10.  
  11. if( $x == $selected )
  12. {
  13. $options .= ' selected="selected"';
  14. }
  15.  
  16. $options .= '>' . $x . '</option>';
  17. }
  18.  
  19. return $options;
  20. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.