Back to Home: PHP FormMail Generator I Need Help : Ask Question Without Registration

How to change Year dropdown with dynamic future year for the email form?
  • admin March 2011
    Question From User:

    One last question, when I add a date section. How do I make it add years instead of subtract? I changed the -100 to +100 but then then nothing shows up in the drop down except the yyyy.


    You can edit the form.php as the following
    highlight to the date field :

    <li class='field_block' id='field_0_div'><div class='col_label'>
        <label class='form_field'>From</
    label> <label class='form_required' >&nbsp;</label> </div>
        <div class='col_field'>
    selectList( "field_0_MM", $_POST["field_0_MM"], 1, 12, "MM", $style ) ;
    selectList( "field_0_DD", $_POST["field_0_DD"], 1, 31, "DD", $style ) ;
    selectList( "field_0_YYYY", $_POST["field_0_YYYY"], date("Y"), date("Y")+2, "YYYY", $style ) ;

    The date("Y") means current year which is 2010, the date("Y")+2 means the next 2 years which is 2012. When the year 2011 comes, the drop down will be 2011 to 2013.