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

How to display Date dropdown in German format in the PHP form?
  • admin March 2011
    From User:

    First of all: fantastic feature! After searching the web for hours I was glad to find (almost) exactly what I need. Except for the following: I need to change the dropdown menu for the date. Required are dates in the future. I tried to adjust the form.php file where the php-code is inserted - without success. Also I would like to put another date format (TT.MM.JJJJ) and the according labels in the form as the website is in German. I would be very glad if you could help me with that.

    Answer:

    You need to change 2 things. One is to display the date in German format TT.MM.JJJJ; The other is to change the year dropdown to the future years.

    The following code is from your attached php form file.  You can change the the following code :

    change this :

    <li class='field_block' id='field_2_div'><div class='col_label'>
        <label class='form_field'>Baubeginn</label> <label class='form_required' >&nbsp;</label> </div>
        <div class='col_field'>
        <?php
    selectList( "field_2_MM", $_POST["field_2_MM"], 1, 12, "MM", $style ) ;
    selectList( "field_2_DD", $_POST["field_2_DD"], 1, 31, "DD", $style ) ;
    selectList( "field_2_YYYY", $_POST["field_2_YYYY"], date("Y")-100, date("Y"), "YYYY", $style ) ;
    ?>

        <div id='field_2_tip' class='instruction'></div>
        </div>
    </li>


    to this :

    <li class='field_block' id='field_2_div'><div class='col_label'>
        <label class='form_field'>Baubeginn</label> <label class='form_required' >&nbsp;</label> </div>
        <div class='col_field'>
        <?php
    selectList( "field_2_DD", $_POST["field_2_DD"], 1, 31, "TT", $style ) ;
    selectList( "field_2_MM", $_POST["field_2_MM"], 1, 12, "MM", $style ) ;
    selectList( "field_2_YYYY", $_POST["field_2_YYYY"], date("Y"), date("Y")+10, "JJJJ", $style ) ;
    ?>

        <div id='field_2_tip' class='instruction'></div>
        </div>
    </li>

    The date("Y") means current year which is 2010, the date("Y")+10 means the next 10 years which is 2021. When the next year 2012 comes, the drop down options will be 2012 to 2022.

    The dropdown looks like the screen shot here :



    image
    Attachments
    german-date-dropdown.jpg 20K