I am trying to dynamically produce the date for each Monday for the year and have them appear in a drop-down box. Any ideas?

    This should do it:

    <?php
    $year=2002;
    $x=1;
    
    $date="<select>";
    
    do
    {
    	$time=strtotime(($x++)." Jan $year");
    	$getdate=getdate($time);
    	if (($getdate['wday']=='1') && ($getdate['year']==$year))
    		$date.="<option>".date('dS F',$time)."</option>";
    }while($getdate['year']==$year);
    
    $date.="</select>";
    
    echo $date;
    
    ?>
    

      Thanks. Modified it a bit so that I do not have to go back in the code to change the year.

      <?
      echo "<select name=\"thedate\">";
      
      $year=date("Y");
      $year2=date("Y") +1;
      $x=1;
      $y=1;
      
      do
      {
         $time=strtotime(($x++)." Jan $year");
      	   $getdate=getdate($time);
      
      if (($getdate['wday']=='1') && ($getdate['year']==$year))
         $date.="<option>".date('m-d-Y, l',$time)."</option>";
      
      }while($getdate['year']==$year);
      echo $date;
      
      do
      {
          $time2=strtotime(($y++)." Jan $year2");
          $getdate2=getdate($time2);
      
      if (($getdate2['wday']=='1') && ($getdate2['year']==$year2))
          $date2.="<option>".date('m-d-Y, l',$time2)."</option>";
      
      }while($getdate2['year']==$year2);
      echo $date2;
      echo "</select>
      ?>
      
        Write a Reply...