I have a php page(calendar.php) which is using javascript to load a php calendar(calendar_start.php) and display the calendar in the center of the page.
I am trying to obtain a variable on the calendar_start.php page, however I cannot access variable which I am able to access from the calendar.php page.
below is one of the scripts used on calendar.php to generate canendar_start.php:
<script language="javaScript" type="text/javascript">
function initialCalendar(){
var hr = new XMLHttpRequest();
var url = "calendar_start.php";
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var year = currentTime.getFullYear();
showmonth = month;
showyear = year;
var vars = "showmonth="+showmonth+"&showyear="+showyear;
hr.open("POST", url, true);
hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
hr.onreadystatechange = function() {
if(hr.readyState == 4 && hr.status == 200) {
var return_data = hr.responseText;
document.getElementById("showCalendar").innerHTML = return_data;
}
}
hr.send(vars);
document.getElementById("showCalendar").innerHTML = "processing...";
}
</script>
and below is part of the page calendar.php where I am generating the calendar:
<body onLoad="initialCalendar(<?php $_GET['page']; ?>);">
I am unable to grab the variable on calendar_start.php and I would really appreciate any help.
Kindest Regards, Ryan
EDIT::
This may be helpful, this is the error when I am trying to display the variable on calendar_start.php
Notice: Undefined index: page in C:\wamp\www\project\calendar_start.php