<?php <br/>//calendar.php<br>//Check if the month and year values exist<br>if ((!$_GET['month']) && (!$_GET['year'])) {<br> $month = date ("n");<br> $year = date ("Y");<br>} else {<br> $month = $_GET['month'];<br> $year = $_GET['year'];<br>}<br>//Calculate the viewed month<br>$timestamp = mktime (0, 0, 0, $month, 1, $year);<br>$monthname = date("F", $timestamp);<br>//Now let's create the table with the proper month<br>?><br><table style="width: 105px; border-collapse: collapse;" border="1" cellpadding="3" cellspacing="0" bordercolor="#000000">
<br> <tr>
<br> <td colspan="7" class="calendartodayoff">
<br> <span style="font-weight: bold;"><?php echo $monthname . " " . $year; ?></span><br> </td>
<br> </tr>
<br> <tr>
<br> <td class="calendartodayoff">
<br> <span style="font-weight: bold;">Su</span><br> </td>
<br> <td class="calendartodayoff">
<br> <span style="font-weight: bold;">M</span><br> </td>
<br> <td class="calendartodayoff">
<br> <span style="font-weight: bold;">Tu</span><br> </td>
<br> <td class="calendartodayoff">
<br> <span style="font-weight: bold;">W</span><br> </td>
<br> <td class="calendartodayoff">
<br> <span style="font-weight: bold;">Th</span><br> </td>
<br> <td class="calendartodayoff">
<br> <span style="font-weight: bold;">F</span><br> </td>
<br> <td class="calendartodayoff">
<br> <span style="font-weight: bold;">Sa</span><br> </td>
<br> </tr>
<br> <?php <br/> $monthstart = date("w", $timestamp);<br> $lastday = date("d", mktime (0, 0, 0, $month + 1, 0, $year));<br> $startdate = -$monthstart;<br> <br> //Figure out how many rows we need.<br> $numrows = ceil (((date("t",mktime (0, 0, 0, $month + 1, 0, $year)) + $monthstart) / 7));<br> <br> //Let's make an appropriate number of rows...<br> for ($k = 1; $k ?><tr>
<?php <br/> //Use 7 columns (for 7 days)...<br> for ($i = 0; $i $startdate++;<br> if (($startdate $lastday)){<br> //If we have a blank day in the calendar.<br> ?><td style="background: #FFFFFF;"> </td>
<?php <br/> } else {<br> <br> if ($startdate == date("j") && $month == date("n") && $year == date("Y")){<br> ?><td class="calendartodayoff" .>',event);" ><?php echo date ("j"); ?>
</td>
<?php <br/> } else {<br> ?><td class="calendaroff" .>',event);" ><?php echo $startdate; ?>
</td>
<?php <br/> }<br> }<br> }<br> ?></tr>
<?php <br/> }<br> ?> <br>
</table>