Print current and next three years

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Print current and next three years

    Hi,

    I am trying to print the current and next three years in a form. Using the
    following code I can only print 2000, 2001, 2002, 2003:

    <select name="start_date_year">
    <?php
    $i = 1;
    while ($i <= 4){
    if ($i + 1 == date("Y", strtotime($_GET[mysql_date]))){
    echo '<option value="'.date("Y", mktime(0, 0, 0, 0, 0, $i)).'"
    selected>'.date("Y", mktime(0, 0, 0, 0, 0, $i)).'</option>';
    } else {
    echo '<option value="'.date("Y", mktime(0, 0, 0, 0, 0,
    $i)).'">'.date("Y", mktime(0, 0, 0, 0, 0, $i)).'</option>';
    }
    $i++;
    }
    ?>
    </select>

    How can I get this code to start looping from the current year?

    Thanks for your help
    Shaun Guest

  2. Similar Questions and Discussions

    1. Print a pdf document with a current timestamp...
      I'd like to be able to print a pdf with the current date and time. I found a third party s/w to do the job but I believe Acrobat is capable of doing...
    2. how can I print current page
      have a multi page SWF that uses an external JPEG for each page. The jpegs are loaded into the SWF from instructions in an XML file. How can I have a...
    3. Print current frame. Real easy one I think.
      Hi, sorry for the ridiculously simpleness of this question, but I want to print everything happenign in the flash movie at a certain point. Kind...
    4. How to change the current thread current culture at run time.
      I have created a new culture : Dim objCulture As New CultureInfo("he") //hebrew When I tried to assign it to the current thread. ...
    5. Send current record data in one form to another and print?
      On Tue, 15 Jul 2003 10:09:12 -0700, "Seddon Acaster" <seddonandjulia@acas.demon.co.uk> wrote: Clarification: The Form doesn't contain any...
  3. #2

    Default Re: [PHP] Print current and next three years

    <select name="start_date_year">
    <?
    for( $i=0;$i<3;$i++ ) {
    $year = date( 'Y' )+$i;
    echo '<option value="'.$year.'">'.$year.'</option>';
    }
    ?>
    </select>

    Edward Dudlik
    Becoming Digital
    [url]www.becomingdigital.com[/url]



    ----- Original Message -----
    From: "Shaun" <shaun@mania.plus.com>
    To: <php-general@lists.php.net>
    Sent: Wednesday, 24 September, 2003 08:29
    Subject: [PHP] Print current and next three years


    Hi,

    I am trying to print the current and next three years in a form. Using the
    following code I can only print 2000, 2001, 2002, 2003:

    <select name="start_date_year">
    <?php
    $i = 1;
    while ($i <= 4){
    if ($i + 1 == date("Y", strtotime($_GET[mysql_date]))){
    echo '<option value="'.date("Y", mktime(0, 0, 0, 0, 0, $i)).'"
    selected>'.date("Y", mktime(0, 0, 0, 0, 0, $i)).'</option>';
    } else {
    echo '<option value="'.date("Y", mktime(0, 0, 0, 0, 0,
    $i)).'">'.date("Y", mktime(0, 0, 0, 0, 0, $i)).'</option>';
    }
    $i++;
    }
    ?>
    </select>

    How can I get this code to start looping from the current year?

    Thanks for your help

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php
    Becoming Digital Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139