There is sth wrong with my code. I am trying to program simple table that will display the days of the month. The internet explorer keeps on loading the page but without any output... Thanks in advance!
<?php
date_default_timezone_set ('Europe/Warsaw');
//11
print "Today is:<br/>";
print date ('jS F Y l G:i a');
//14
?>
</head>
<body>
<?php
//20 creating date variables
$month=date('n');
$year=date('Y');
$day=date('j');
$previous_year=$year--;
$next_year=$year++;
$previous_month=$month--;
$next_month=$month++;
//32 what day of the week is the first day of the month
$first_day=mktime(0,0,0,$month,1,$year);
$day_of_week=date('D',$first_day);
print "<table border=1 width=358>";
print "<tr> $month $year </tr>";
print "<tr><td><td width=50>Monday</td>";
print "<td><td width=50>Tuesday</td>";
print "<td><td width=50>Wednesday</td>";
print "<td><td width=50>Thursday</td>";
print "<td><td width=50>Friday</td>";
print "<td><td width=50>Saturday</td>";
print "<td><td width=50>Sunday</td></tr>";
//blank days in calendar table
$day_of_week = date('D', $first_day);
switch($day_of_week){
case "Sun": $blank = 0; break;
case "Mon": $blank = 1; break;
case "Tue": $blank = 2; break;
case "Wed": $blank = 3; break;
case "Thu": $blank = 4; break;
case "Fri": $blank = 5; break;
case "Sat": $blank = 6; break;
}
//setting the day count at 1
$day_count=1;
print "<tr>";
//62 while loop to generate first blank days and than all days in the month
while ( $blank >0 ) {
print "<td></td>";
$blank=$blank-1;
$day_count++;
}
$days_in_month=cal_days_in_month(0,$month,$year);
$day_number=1;
//77 while loop to generate the days of the month
while ($day_number<=$days_in_month) {
print "<td> $day_number </td>";
$day_number++;
$day_count++;
//84 new week starting at new row
if($day_count>7) {
print "<tr></tr>";
$day_count=1;
}
}
//91 blank days for not filled days at the end of month
while ( $day_count>1 AND $daycount<=7) {
print "<td></td>";
$day_count++;
}
//96 end of the calendar table
print "</tr></table>";
?>
</body>
</html>