Calendar Bounty

in

As a new site having to do with technology and offering a section for bounties, I have a task for anybody that joins.

See the small calendar on the left below everything else? Well, I want to make this interactive providing links on active days. Such as if there is an event posted for August 26, 2008, I want users to be able to click that date and view all events listed for that date. This will consist of a query to a MySQL database to gather information from a submitted webform (not created yet). I would like for this to all be in a single (clean) PHP script. If needed, the block on the side can be turned into a new page entirely. Here's the code as it already is.

<br />
<?php<br />
$now = getdate(time());<br />
$time = mktime(0,0,0, $now['mon'], 1, $now['year']);<br />
$date = getdate($time);<br />
$dayTotal = cal_days_in_month(0, $date['mon'], $date['year']);<br />
//Print the calendar header with the month name and year.<br />
print '<br />
<table>
<tr>
<td colspan="7"><strong>' . $date['month'] . '</strong></td>
</tr>
<p>';<br />
print '<br />
<tr>
<td colspan="7"><strong>' . $date['year'] . '</strong></td>
</tr>
<p>';<br />
for ($i = 0; $i < 6; $i++) {<br />
print '<br />
<tr>';<br />
for ($j = 1; $j <= 7; $j++) {<br />
$dayNum = $j + $i*7 - $date['wday'];<br />
//Print a cell with the day number in it.  If it is today, highlight it.<br />
print '<br />
<td';<br />
if ($dayNum > 0 && $dayNum <= $dayTotal) {<br />
print ($dayNum == $now['mday']) ? ' style="background: #ccc;">' : '>';<br />
print $dayNum;<br />
}<br />
else {<br />
//Print a blank cell if no date falls on that day, but the row is unfinished.<br />
print '>';<br />
}<br />
print '</td>
<p>';<br />
}<br />
print '</tr>
<p>';<br />
if ($dayNum >= $dayTotal && $i != 6)<br />
break;<br />
}<br />
print '</table>
<p>';<br />
?><br />

Any takers?

By the way, there is no pay or prize for this bounty except for the fact that the final product will be used on this site.

__________________

Open source is better with an open mind.