can someone tell me if I need AJAX to do what I need here? I have this function which creates a calendar. I'm going to insert some 'forward' and 'backward' arrows keys so the user can scroll through the months.
So on clicking the forward button; I want to get the next month - and display that month instead of the one present. This means reloading the function, right? But with a different variable for month. Also, I can't have the PHP display itself once more without using JavaScript of some sort, right?
I know I can make the same calendar with JavaScript but I want to see how it works using PHP. I've also never used AJAX functionality before, I'm not sure how I'd change the variable of a script in this way really..
function create_Calendar($month,$year){
$i = "";
$days_array = array("Mon","Tue","Wed","Thur","Fri","Sat","Sun");
$days_in_month = cal_days_in_month(CAL_GREGORIAN,$month,$year);
$jd = cal_to_jd(CAL_GREGORIAN,$month,date("d"),$year);
$first_day = jddayofweek($jd,0);
$month_name = jdmonthname($jd,3) . " " . date("Y");
echo("<div id='calendar'>");
echo("<div id='month_name'>" . $month_name . "</div>");
for($i=0;$i<7;$i++){
echo("<div class='day_titles'>" . $days_array[$i] . "</div>");
}
for($i=0;$i<$first_day;$i++){
echo("<div class='blank_days'></div>");
}
for($i=1;$i<=$days_in_month;$i++){
echo("<div class='day'>" . $i . "</div>");
}
echo("<div class='day_tooltip'></div>");
echo("</div");
};
I am calling the function with:
create_Calendar(date("m"),2013);
Any help is appreciated.