Code: Select all
<?php
$month = date('n');
$year = date('Y');
$day = date('j');
$daysInMonth = date("t", mktime(0,0,0, $month,1,$year));
$firstDay = date("w", mktime(0,0,0,$month,1,$year));
$tempDays = $firstDay + $daysInMonth;
$weeksInMonth = ceil($tempDays/7);
if($month==1){
$m="January";
}
elseif($month==2){
$m="February";
}
elseif($month==3){
$m="March";
}
elseif($month==4){
$m="April";
}
elseif($month==5){
$m="May";
}
elseif($month==6){
$m="June";
}
elseif($month==7){
$m="July";
}
elseif($month==8){
$m="August";
}
elseif($month==9){
$m="September";
}
elseif($month==10){
$m="October";
}
elseif($month==11){
$m="November";
}
elseif($month==12){
$m="December";
}
?>
<div id="tcal">
<table class="ctrl">
<tbody>
<tr>
<td><a href="" onclick="http.open('get', 'calendar.php); document.getElementById("tcal").innerHTML = http.responseText; "<img src="img/prev_year.gif"> </td>
<td><img src="img/prev_mon.gif"> </td>
<th><?php echo $m ?> <?php echo $year ?></th>
<td><img src="img/next_mon.gif"></td>
<td><img src="img/next_year.gif"></td>
</tr>
</tbody>
</table>
I have the "next month icon" as an image and onclick I am trying to use the http.open command to update the variable $month by 1 and have the calender display asynchronously update.
<td><a href="" onclick="http.open('get', 'index.php); document.getElementById("tcal").innerHTML = http.responseText; "<img src="img/prev_year.gif"> </td>
What am I doing wrong? and how can I get this to work?