Posted By

tasmanweb on 04/30/11


Tagged

php date function


Versions (?)

Makes a html year select starting at the current + the next 2 years


 / Published in: PHP
 

  1. /*
  2. Makes a html year select starting at the current + the next 2 years
  3. The string passed is the name of the select.
  4. usage:
  5. echo select_years('pickup_year');
  6. */
  7. function select_years($name){
  8. return '
  9. <select name="'.$name.'">
  10. <option value="'.date("Y").'" SELECTED>'.date("Y").'</option>
  11. <option value="'.(date("Y")+1).'">'.(date("Y")+1).'</option>
  12. <option value="'.(date("Y")+2).'">'.(date("Y")+2).'</option>
  13. </select>';
  14. }

Report this snippet  

You need to login to post a comment.