Posted By

gdonald on 09/27/06


Tagged

month options


Versions (?)

PHP month options


 / Published in: PHP
 

  1. function getMonthOptions( $selected )
  2. {
  3. $options = '';
  4.  
  5. for( $x = 1; $x < 13; $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  

You need to login to post a comment.