I downloaded this calendar off the web and am trying have it show twice, once as calendar.php and the second time as calendar1.php
I need the visitor to be able to select a beginning date and an ending date. Here is the primary page that I have
[CODE]
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Your Title</title>
<link rel="stylesheet" type="text/css" href="calendar_style.css">
<script type="text/javascript">
var req;
function navigate(month,year) {
var url = "calendar.php?month="+mont
h+"&year="
+year;
if(window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if(window.ActiveXObject) {
req = new ActiveXObject("Microsoft.X
MLHTTP");
}
req.open("GET", url, true);
req.onreadystatechange = callback;
req.send(null);
}
function callback() {
if(req.readyState == 4) {
if(req.status == 200) {
response = req.responseText;
document.getElementById("c
alendar").
innerHTML = response;
} else {
alert("There was a problem retrieving the data:\n" + req.statusText);
}
}
}
</script>
<script type="text/javascript">
var req;
function navigate1(month,year) {
var url = "calendar1.php?month="+mon
th+"&year=
"+year;
if(window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if(window.ActiveXObject) {
req = new ActiveXObject("Microsoft.X
MLHTTP");
}
req.open("GET", url, true);
req.onreadystatechange = callback;
req.send(null);
}
function callback1() {
if(req.readyState == 4) {
if(req.status == 200) {
response = req.responseText;
document.getElementById("c
alendar1")
.innerHTML
= response;
} else {
alert("There was a problem retrieving the data:\n" + req.statusText);
}
}
}
</script>
<script type="text/javascript">
function init()
{
navigate("","");
navigate1("","");
}
//-->
</script>
</head>
<body onLoad="init()">
<div id="calendar" style="margin-top: 20px;margin-bottom: 20px"></div>
</body>
</html>
[/CODE]
Here is the AJAX Calendar
[CODE]
<?
$output = '';
if($_GET[month] == '' && $$_GET[year] == '') {
$time = time();
$month = date('n',$time);
$year = date('Y',$time);
}
$date = getdate(mktime(0,0,0,$mont
h,1,$year)
);
$today = getdate();
$hours = $today[hours];
$mins = $today[minutes];
$secs = $today[seconds];
if(strlen($hours)<2) $hours="0".$hours;
if(strlen($mins)<2) $mins="0".$mins;
if(strlen($secs)<2) $secs="0".$secs;
$days=date("t",mktime(0,0,
0,$month,1
,$year));
$start = $date[wday]+1;
$name = $date[month];
$year2 = $date[year];
$offset = $days + $start - 1;
if($month==12) {
$next=1;
$nexty=$year + 1;
} else {
$next=$month + 1;
$nexty=$year;
}
if($month==1) {
$prev=12;
$prevy=$year - 1;
} else {
$prev=$month - 1;
$prevy=$year;
}
if($offset <= 28) $weeks=28;
elseif($offset > 35) $weeks = 42;
else $weeks = 35;
$output = "<table class='daytable' cellpadding='3' cellspacing='1' align='center'>
<tr>
<td colspan='7'>
<table border='0' width='100%'>
<tr>
<td valign='middle'>
<a href='javascript:navigate(
$prev,$pre
vy)'><img src='left.gif' border='0'></a><a href='javascript:navigate(
\"\",\"\")
'><img src='center.gif' hspace='3' border='0'></a><a href='javascript:navigate(
$next,$nex
ty)'><img src='right.gif' border='0'></a>
</td>
<td align='right'>
<div id='heading'>$name $year2</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class='dayhead'>Sun</td>
<td class='dayhead'>Mon</td>
<td class='dayhead'>Tue</td>
<td class='dayhead'>Wed</td>
<td class='dayhead'>Thu</td>
<td class='dayhead'>Fri</td>
<td class='dayhead'>Sat</td>
</tr>";
$col=1;
$cur=1;
$next=0;
for($i=1;$i<=$weeks;$i++) {
if($next==3) $next=0;
if($col==1) $output.="<tr class='dayrow'>";
$output.="<td valign='top' class='days' onMouseOver=\"this.style.b
ackgroundC
olor='#EEE
EEE'\" onMouseOut=\"this.style.ba
ckgroundCo
lor='#FFFF
FF'\">";
if($i <= ($days+($start-1)) && $i >= $start) {
$output.="<div";
if(($cur==$today[mday]) && ($name==$today[month])) $output.=" style='color:#FF0000'";
$output.="><b>$cur</b>";
$output.="</div></td>";
$cur++;
$col++;
} else {
$output.=" </td>";
$col++;
}
if($col==8) {
$output.="</tr>";
$col=1;
}
}
$output.="</table>";
echo $output;
?>
[/CODE]
All I did is make a copy of calendar.php to calendar1.php and copied and changed the function from navigate() to navigate1().
somehow or another I am lost in what I did and appreciate any help to get both calendars to display at the same time and they will both have different outputs.
An arrival time and a departure time.
The page is up and running at
http://www.reserveitnow.us/calendar1/ajax_calendar.phpThanks in Advance