title: in html <select>, php code to add <option>s
body: <p>I would like to add the years 2011-2001 in my drop-down-box (2012-2002 in next year, etc...).</p>
  
  <p>Since I don't want to change my code I thought to do it in php.</p>
  
  <p>I had it like this which worked:</p>
  
  <pre><code>&lt;select name="purchaseYear" size="1"&gt;
     &lt;?echo "&lt;option&gt;" . date("Y") . "&lt;/option&gt;";?&gt;
     &lt;?echo "&lt;option&gt;" . date("Y") - 1 . "&lt;/option&gt;";?&gt;
     ...
  &lt;/select&gt;
  </code></pre>
  
  <p>Now I want to realise it with a for-loop and tried it like this:</p>
  
  <pre><code>&lt;select name="purchaseYear" size="1"&gt;
      &lt;?
      for ($i = 0; $i &lt;= 9; $i++) {
         echo "&lt;option&gt;" . date("Y") - $i . "&lt;/option&gt;";
      }
      ?&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Which gave me an empty drop-down-box.</p>
  
  <p>What do I need to change? And why didn't it work?</p>