Hi,
I am trying to modify these codes to where I can use my PHP /MySql Database.
I have an event section in the database that list the month year and day of the event as well as the title of event and description.
As of now I have all the event being show on the events page, but my client would like it where the calendar lets the users click on it to see all the events on that day.
I would also I like it if I could let the day of the event changes background color and text (according if there is something in the database with that particular date)
Can someone please help me? Thank you in advance ^_^
Codes are here:
$x=$_GET[x];
if($x=="") $x = date("n");
$date = strtotime("2006/$x/1");
$day = date("D",$date);
$m = date("F",$date);
$totaldays = date("t",$date); //get the total day of specified date
echo "<table border = '1' cellspacing = '0' bordercolor='blue' cellpadding ='2'><tr>
<td colspan='7'>$m</td></tr>
<tr>
<td><font size = '1' face = 'tahoma'>Sun</font></td>
<td><font size = '1' face = 'tahoma'>Mon</font></td>
<td><font size = '1' face = 'tahoma'>Tue</font></td>
<td><font size = '1' face = 'tahoma'>Wed</font></td>
<td><font size = '1' face = 'tahoma'>Thu</font></td>
<td><font size = '1' face = 'tahoma'>Fri</font></td>
<td><font size = '1' face = 'tahoma'>Sat</font></td>
</tr>
";
if($day=="Sun") $st=1;
if($day=="Mon") $st=2;
if($day=="Tue") $st=3;
if($day=="Wed") $st=4;
if($day=="Thu") $st=5;
if($day=="Fri") $st=6;
if($day=="Sat") $st=7;
if ($st >= 6 && $totaldays == 31) {
$tl=42;
}elseif($st == 7 && $totaldays == 30){
$tl = 42;
}else{
$tl = 35;
}
$ctr = 1;
$d=1;
for($i=1;$i<=$tl;$i++){
if($ctr==1) echo "<tr>";
if($i >= $st && $d <= $totaldays){
echo "<td align='center'><font size = '2' face = 'tahoma'>$d</font></td>";
$d++;
}
else{
echo "<td> </td>";
}
$ctr++;
if($ctr > 7) {
$ctr=1;
echo "</tr>";
}
}
$prev=$x - 1;
$next = $x + 1;
if($prev==0) $prev=1;
if($next==13) $next = 12;
echo "</table><b><a href = 'calendar.php?x=$prev'>Previous</a> <a href = 'calendar.php?x=$next'>Next</a></b>";