I have downloaded a PHP CSS calendar from Fresh Mango. This is not a spam for the site. I like the calendar because it loads fast and is css customizable. On the link is just the code without the css pretty stuff but there is also a link to download the very small zip.
Here is the code:
<h3>PHP CSS Calendar Example</h3>
<table id="calendar" cellspacing="0" cellpadding="0" summary="This month's calendar">
<?php
$day = @$_GET["day"];
$month = @$_GET["month"];
$year = @$_GET["year"];
if ($month == ""){
$day = date('d');
$month = date('n');
$year = date('Y');
}
$firstOfMonthDateStamp = mktime(12, 59, 59, $month, 1, $year);
$daysInCurrentMonth = date("t", $firstOfMonthDateStamp);
$firstOfMonthDay = date("d", $firstOfMonthDateStamp);
$lastOfMonthDay = date("w", strtotime(date("n",$firstOfMonthDateStamp)."/".$daysInCurrentMonth."/".date("Y",$firstOfMonthDateStamp)));
$previousMonth = getdate(strtotime('-1 month', $firstOfMonthDateStamp));
$nextMonth = getdate(strtotime('+1 month', $firstOfMonthDateStamp));
?>
<caption><a href="calendar.php?day=<?php echo $day ?>&month=<?php echo $previousMonth['mon'] ?>&year=<?php echo $previousMonth['year'] ?>" title="View Previous Month (<?php echo $previousMonth['month'] ?>)"><<</a> <?php echo date("F", $firstOfMonthDateStamp) ?> <?php echo date("Y",$firstOfMonthDateStamp) ?> <a href="calendar.php?day=<?php echo $day ?>&month=<?php echo $nextMonth['mon'] ?>&year=<?php echo $nextMonth['year'] ?>" title="View Next Month (<?php echo $nextMonth['month'] ?>)">>></a></caption>
<tr><th abbr="Sunday" title="Sunday">S</th><th abbr="Monday" title="Monday">M</th><th abbr="Tuesday" title="Tuesday">T</th><th abbr="Wednesday" title="Wednesday">W</th><th abbr="Thursday" title="Thursday">T</th><th abbr="Friday" title="Friday">F</th><th abbr="Saturday" title="Saturday">S</th></tr>
<tr>
<?php
//ASP/PHP WRITTEN BY BOB MCKAY, WWW.FRESHMANGO.COM - USE AS YOU WISH BUT PLEASE LEAVE THIS IN PLACE
//DESIGN, CSS AND XHTML ALL BY VEERLE, HTTP://VEERLE.DUOH.COM
$columnCounter = 0;
//FOR fillLeadingEmptyDays = 1 TO ($firstOfMonthDay - 1)
for ($fillLeadingEmptyDays=0; $fillLeadingEmptyDays <= ($firstOfMonthDay - 1); $fillLeadingEmptyDays+=1)
{
$columnCounter = $columnCounter + 1;
echo "<td></td>";
}
for ($enterDays=1; $enterDays <= $daysInCurrentMonth; $enterDays+=1)
{
$columnCounter = $columnCounter + 1;
echo "<td><a ";
if ($enterDays == $day)
{
echo " class = \"today\"";
}
$dayLinkDestination = "#";
echo " href=\"".$dayLinkDestination."\">".$enterDays."</a></td>";
if ( $columnCounter == 7 )
{
echo "</tr><tr>";
$columnCounter = 0;
}
}
for ($fillEmptyDays=($columnCounter + 1); $fillEmptyDays <= 7; $fillEmptyDays+=1)
{
if ($columnCounter ==0)
{
break;
}
echo "<td></td>";
}
?>
</tr>
</table>
</p>
<p>
<input name="date_entered" type="text" id="date_entered" size="20" maxlength="20" value="<?php echo $chosendate ?>" />
</p>
What I have been trying to do is set it up so when a cell or link is clicked a variable is set and displayed in a text field. I have tried to do several iterations of the "onclick" for the cell or the day link.
You can see my work at my calendar page. but it does nothing because I cannot get it working.
So I am asking for a bit of direction do get me looking in the right direction. I think I am looking the wrong way.
Thanks