php calendar not functioning correctly

Hi, I’m building a calendar for a website and I’m having trouble figuring out how to get the calendar code to function properly. Not versed in php or ajax, so I’m unable to locate the faulty area of the code. I used a tutorial from youtube to build it… the calendar works just fine on his demonstration, but doesn’t when I execute the code myself. I can get the functionality to work, but then the majority of the calendar shows up. And when I change things to get the calendar to show up, the functionality doesn’t work. If anyone can help me locate my problem, I would really appreciate it.

Here is the php I’m using:
[php]<?php
$showmonth = $_POST[‘showmonth’];
$showyear = $_POST[‘showyear’];
$showmonth = preg_replace(’#[^0-9]#i’, ‘’, $showmonth);
$showyear = preg_replace(’#[^0-9]#i’, ‘’, $showyear);

$day_count = cal_days_in_month(CAL_GREGORIAN, $showmonth, $showyear);
$pre_days = date(‘w’, mktime(0, 0, 0, $showmonth, 1, $showyear));
$post_days = (6 - (date(‘w’, mktime(0, 0, 0, $showmonth, $day_count, $showyear))));

echo ‘

’;
echo ‘
’;
echo ‘
’;
echo ‘
’ . $showmonth . ‘/’ . $showyear . ‘
’;
echo ‘
’;
echo ‘
’;
echo ‘
’;
echo ‘
Sun
’;
echo ‘
Mon
’;
echo ‘
Tue
’;
echo ‘
Wed
’;
echo ‘
Thur
’;
echo ‘
Fri
’;
echo ‘
Sat
’;
echo ‘
’;
echo ‘
’;

// Previous Month Filler Days /
if ($pre_days != 0) {
for($i=1; $i<=$pre_days; $i++) {
echo ‘

’;
}
}
/
Current Month */
for($i=1; $i<= $day_count; $i++) {
echo ‘

’;
echo ‘
’ . $i . ‘
’;
echo ‘
’;

}
/* Next Month Filler Days */
if ($post_days != 0) {
for ($i=1; $i<=$post_days; $i++) {
echo ‘

’;
}
}
echo ‘
’;
?>[/php]

This is the Html/Ajax:

[code]

[/code]

And this is the Css:

#calendar_wrap { width: 924px; margin-left: auto; margin-right: auto; overflow: hidden; } .title_bar { width: 100%; height: 30px; } .previous_month { float: left; width: 308px; height: 30px; text-align: left; } .show_month { float: left; width: 308px; height: 30px; text-align: center; } .next_month { float: left; width: 308px; height: 30px; text-align: right; } .week_days { width: 100%; } .days_of_week { float: left; width: 14%; text-align: center; } .cal_day { position: relative; float: left; margin-right: 4px; margin-bottom: 4px; width: 128px; height: 95px; background-color: #9C9; } .day_heading { position: relative; float: left; width: 40px; height: 16px; padding: 6px; color: #000; font-family: Arial; font-size: 14px; } .openings { width: 100%; clear: left; text-align: center; } .non_cal_day { position: relative; float: left; margin-right: 4px; margin-bottom: 4px; width: 128px; height: 95px; background-color: #CCC; } .clear { clear: both; }

Sponsor our Newsletter | Privacy Policy | Terms of Service