MySQL Table Search »

Event Calendar

Price: FREE Version: 1.0
The Event Calendar script is a free piece of PHP code to create an event calendar for you. Below is a description of the files used and what each one of them does.

calendar.css - external CSS file which lets you easily change the appearance. If you do not know how to locate the styles used for each calendar element please refer to "Inspect CSS styles using Chrome" video found here

calendar.js - all the JS functions used to scroll the calendar and the ajax calls made to load both the calendar and the events

calendar.php - this is the PHP script used to build and print the calendar widget

config.php - the file where mysql database login is defined

database.sql - mysql table structure

events.php - this is the PHP file which loads the events once you click on a date

example-page.html - a sample web page with embed calendar widget.

75 Comments to "Event Calendar"

Dan November 24, 2014 at 4:08 pm | Reply


Hey all... I've got this working and hooked up, but I'm trying to add functionality... I'm trying to make it automatically display the events on the current day (if there are any) by default, without having to click anything. Here's what I've done...

On calendar.js, I added some lines at the bottom: (Note: I've made changes to the directory and file names, but all are still functioning properly)

function LoadMonth(month, year) {
ajaxpage("admin/event_calendar.php?month="+month+"&year="+year, "Calendar")
function LoadEvents(date) {
ajaxpage("admin/cal_events.php?date="+date, "Events")
function LoadToday(date) {
ajaxpage("admin/current_date.php", "Today")


My current_date.php file loads the current date just the came as the event.php file does, and when I access current_date.php directly, it works fine in displaying the events that are registered for that specific date.

When I load the calendar, it does not load the events for that day. It loads up like normal and seemingly ignores the LoadToday() command.

I know little to none about javascript, so perhaps I've missed something altogether. Any help?

caleb November 21, 2014 at 9:31 am | Reply


Not working for 2015 events
can scrolling to new date be faster
AbdulRauf November 5, 2014 at 9:20 am | Reply


how can add events to Calendar?
Daniel October 23, 2014 at 4:01 pm | Reply


Thanks for this great calendar. I was wondering if it would be possible to use timestamp for the date format in database. I tried something but nothing worked for me yet.
Daniel October 23, 2014 at 11:09 pm


unix timestamp
tajuboy1 October 20, 2014 at 7:08 pm | Reply


Some body should help how can i add events without go through phpmyadmin
Trilochan October 10, 2014 at 11:31 pm | Reply


Hi, Thank you for this php event calender but I found some problem like when I added events in January 2015 it not showing in calender. please help me.
Sparky October 11, 2014 at 12:27 am


I would check the program you use to insert new events. I just added 3 new events directly through phpMyAdmin(sql) panel, and all showed up on the calendar perfectly. Check the database directly (phpMyAdmin) and make sure they are formatted correctly, and actually inserted. The date format is 2015-02-01. I hope this helps.
kabal8 October 6, 2014 at 1:47 pm | Reply



at first, great praise!!
The calendar with the corrections is very nice.
It would be really great if you could popup the events in a separate window. (Example: alert(); )

Can anyone help me

Thanks and best regards

Kenny September 16, 2014 at 7:32 pm | Reply


hi.,.can anyone help me about this, i want to highlight also the current date.,.how can i do that?
Streak September 16, 2014 at 5:44 pm | Reply


Is it Possible to Highlight the Current Day? ex. if the today is 9/16/2014. the 16 in the calendar is highlighted. TIA
Sparky September 16, 2014 at 11:12 pm


One thing to keep in mind, is if you highlight the current date with a background color like the event days, and there is an event on the current day, it would highlight as a current day, not current day AND event. A few simple changes there... but 20 minutes later, here is the 'Current Day' highlight code... (I have make a LOT of changes to the original code, so I hope this makes sense to you)

In calendar.css, add:
 #Calendar .today {
border:2px solid #000;

In calendar.php, there are 3 changes...
 (intval($_REQUEST["year"])>0) ? $cYear = intval($_REQUEST["year"]) : $cYear = date("Y"); 

 (intval($_REQUEST["year"])>0) ? $cYear = intval($_REQUEST["year"]) : $cYear = date("Y");

// to highlight current day
$tDay = date("d");
$tMonth = date("m");
$tYear = date("Y");

 if ($current_day<10) $current_day = '0'.$current_day; 

 if ($current_day<10) $current_day = '0'.$current_day;
if ($tDay == $current_day && $tMonth == $cMonth && $tYear == $cYear) { $tCurrent = "today";} else {$tCurrent = "";}

 if (isset($events[$cYear."-".$cMonth."-".$current_day]) && $events[$cYear."-".$cMonth."-".$current_day]<>'') {
$click = "onclick=\"LoadEvents('".$cYear."-".$cMonth."-".$current_day."')\"";
} else {
$click = '';

 if (isset($events[$cYear."-".$cMonth."-".$current_day]) && $events[$cYear."-".$cMonth."-".$current_day]<>'') {
$css='withevent '.$tCurrent;
$click = "onclick=\"LoadEvents('".$cYear."-".$cMonth."-".$current_day."')\"";
} else {
$css='noevent '.$tCurrent;
$click = '';
Sparky September 16, 2014 at 11:21 pm


Oh, I wish there was a preview, or edit post :( Anyways, the example CSS I gave will put a border around the 'current day', so it will be noticable, and still have a background highlight if there is an event on the same day. You can change the CSS however you want :)
Streak October 9, 2014 at 5:14 am


Thanks for This btw. i have been trying to show the events in pop up message upon clicking instead of echoing it at the bottom, but no luck here. is it possible to show it in pop up box?
Streak October 9, 2014 at 7:00 am


or displaying the events with their corresponding day without clicking is it possible? TIA
Abhay September 15, 2014 at 9:41 am | Reply


Not working with wamp server 2.5
i tried to import database file but not able to thn i created the database..
but not able to execute in netbeans 8.0
please kindly provide me the steps how to install n how to work upon it
m a beginner

Please be polite and helpful and do not spam or offend others. We promise you will be treated the same way.

Log in your free account or if you still haven't joined you can create your free account now.

Posting tip:
if you use code in your comments please put it in these tags [php], [sql], [css], [js]
PHP code example: [php] echo date("Y-m-d"); [/php]

Thank you,
~ PHPJabbers team ~