This is all one page called: calender.php. I tried to seperate the different code using the unique tage for each but all the code presented should be in one page. Feel free to try it out and make mods accordingly, also present new ideas or adjustments made for debugging purposes. Thanks! enjoy.
[code=php]
<?php
function display_calender() {
$start_day = date(“w”, mktime(0, 0, 0, date(‘n’), 1, date(‘Y’)));
$month_days = date(“t”);
$today = strtoupper(date(“F Y”));
echo (“<table class=’calender’>n<tr>n”);
echo (“<td colspan=’7′>$today</td>n</tr>n<tr>n”);
echo (“<th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th>n</tr>n<tr>n”);
for ($i=0; $i<$start_day; $i++) {
echo (“<td> </td>”);
}
for ($j=1; $j<=$month_days; $j++) {
if ($j == date(‘j’)) {
echo (“<td class=’todays_date’>$j</td>”);
}else{
echo (“<td>$j</td>”);
}
if (($j+$start_day)%7 == 0) {
echo (“n</tr>n<tr>n”);
}
}
echo (“n</tr>n</table>n”);
}
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html dir=”ltr” lang=”en”>
<head>
<title>Calender</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″ />
<meta name=”keywords” content=”” />
<meta name=”description” content=”” />
<style type=”text/css”>
<!–
.calender {
text-align: center;
background: #e5e5e5;
color: #800000;
border: 1px solid silver;
}
.calender tr td {
border: 1px solid silver;
}
.todays_date {
background: #800000;
color: #e5e5e5;
}
–>
</style>
</head>
<body>
<?php display_calender(); ?>
</body>
</html>