Loading ...
Sorry, an error occurred while loading the content.
 

Date (Year) Select

Expand Messages
  • albertp3
    I want to generate a select for a long list of years. I don t want to code it by hand. If I wasn t using this class I would do it like this: $year=date( Y );
    Message 1 of 2 , Dec 28, 2006
      I want to generate a select for a long list of years. I don't want to code it by hand. If I wasn't
      using this class I would do it like this:

      $year=date("Y");
      $first_year = $year-75;
      $yearEnd=$year+2;

      echo "<select>\n";
      for($year=$first_year; $year <= $yearEnd; $year++) {
      print "<option value=\"$year\">$year</option>";
      }

      How can I do the same thing using the Forms class?
    • Manuel Lemos
      Hello, ... This message was already replied here: http://www.phpclasses.org/discuss/package/1/thread/44/ -- Regards, Manuel Lemos Metastorage - Data object
      Message 2 of 2 , Dec 30, 2006
        Hello,

        on 12/28/2006 05:24 PM albertp3 said the following:
        > I want to generate a select for a long list of years. I don't want to code it by hand. If I wasn't
        > using this class I would do it like this:
        >
        > $year=date("Y");
        > $first_year = $year-75;
        > $yearEnd=$year+2;
        >
        > echo "<select>\n";
        > for($year=$first_year; $year <= $yearEnd; $year++) {
        > print "<option value=\"$year\">$year</option>";
        > }
        >
        > How can I do the same thing using the Forms class?

        This message was already replied here:

        http://www.phpclasses.org/discuss/package/1/thread/44/

        --

        Regards,
        Manuel Lemos

        Metastorage - Data object relational mapping layer generator
        http://www.metastorage.net/

        PHP Classes - Free ready to use OOP components written in PHP
        http://www.phpclasses.org/
      Your message has been successfully submitted and would be delivered to recipients shortly.