no I missed that one -thanks for pointing it out

Chris
// define LAST block - START
$last_month_start = (START_MONTH-MONTHS_TO_SHOW); # remove months_to_show x 2 to go back this block and then 1 more
$last_year_start = START_YEAR;
if($last_month_start<0){
$last_month_start=$last_month_start+12;
--$last_year_start;
}
$last_month_start=sprintf("%02s",$last_month_start);
// define NEXT block - START
$next_month_start = $this_month; # just use MONTH number that the loop has ended on
$next_year_start = $this_year; # just use YEAR number that the loop has ended on
if($next_month_start>12){
$next_month_start=$next_month_start-12;
++$next_year_start;
}
$next_month_start=sprintf("%02s",$next_month_start);
<select name="year_month" onchange="this.form.submit()">
<option value=""> - select months to show - </option>
<option value=""> Current '.MONTHS_TO_SHOW.' months </option>
<option value="'.$last_year_start.'-'.$last_month_start.'">Previous '.MONTHS_TO_SHOW.' months</option>
<option value="'.$next_year_start.'-'.$next_month_start.'" >Following '.MONTHS_TO_SHOW.' months</option>
</select>
// define LAST block - START
$last_month_start = (START_MONTH-MONTHS_TO_SHOW); # remove months_to_show x 2 to go back this block and then 1 more
$last_year_start = START_YEAR;
if($last_month_start<0){
$last_month_start=$last_month_start+12;
--$last_year_start;
}
// define LAST block - START
$last_month_start = (START_MONTH-MONTHS_TO_SHOW); # remove months_to_show x 2 to go back this block and then 1 more
$last_year_start = START_YEAR;
if($last_month_start<1){
$last_month_start=$last_month_start+12;
--$last_year_start;
}
// define NEXT block - START
$next_month_start = $this_month; # just use MONTH number that the loop has ended on
$next_year_start = $this_year; # just use YEAR number that the loop has ended on
if($next_month_start>11){
$next_month_start=$next_month_start-12;
++$next_year_start;
}
// define NEXT block - START
$next_month_start = $this_month; # just use MONTH number that the loop has ended on
$next_year_start = $this_year; # just use YEAR number that the loop has ended on
if($next_month_start>12){
$next_month_start=$next_month_start-12;
++$next_year_start;
}
PS. one thing I forgot to ask.... how did you "find" this script?
$the_months = array();
$k = $cur_month;
$j = 0;
while($j<MONTHS_TO_SHOW){
$this_month=sprintf("%02s",$k);
$the_months[$this_month]=array("year"=>$cur_year,"month"=>$this_month);
$j++;
if($k==12){
// start new year and reset counter to 1 (jan)
$cur_year=$cur_year+1;
$k=1;
}else{
$k++;
}
}
// loop through months to draw calendar
$j=1;
$cal_months='';
foreach($the_months as $key=>$val){
$cal_months.='<td valign="top" align="center">'.draw_cal(ID_ITEM,$val["month"], $val["year"], $booked_days,1).'</td>';
if (($j % 3) == 0)$cal_months.="</tr><tr>";
++$j;
}
Users browsing this forum: No registered users and 2 guests