Free PHP Booking Slots Calendar

May 25th, 2014

This is the second and latest version of my PHP Booking Slots Calendar.
I got so many emails requesting new features and this version contains the following:

  • Set the starting and ending slot times
  • Set as many slots her hour as you need
  • Set the cost per slot
  • Recognises part booked, fully booked, and past dates
  • Set a closed day(s) when no bookings can be made
  • Set alternative currencies
  • Leap year safe

After a booking is made, a user ends up at the book_slots.php page.
This is the page which actually books the slots. I left this page deliberately sparse so that you can integrate it with your own basket or redirect the user to a payment gateway.
Check out the live demo here.


This code is provided “as is” for developers to use or customise as they see fit.
Some requests may make it onto the next build but I am unable to respond to specific requirements.
Emails like “can you make it so that it works with my website and it pings emails when someone pays by Cardmax” are unlikely to get much attention…


The PHP Booking Slots Calendar works with IE7+, Ipad, Chrome and Firefox.
Older browsers may struggle to correctly display the “Make Booking” button because it uses CSS3.

PHP Free Booking Slots Calendar


When a checkbox is clicked, the basket section shows the current total cost and selected slots. The cost and slots are recalculated every time a slot is clicked.

Selected Slots

Setting up the calendar

All you need is a MySQL database and connection details, and the ability to upload files to your server.
I have included calendar_table_schema.sql file which you can use to import directly into phpMyAdmin. Your “bookings” table should look like this:

MySQL bookings schema

Free to use, let me know how you get on, I’d like to hear from you.

Download PHP Booking Slots Calendar

Click here to download PHP Booking Slots Calendar

  • William

    Thank you sooo much for your work on this booking calendar and for allowing others to use it. Is there a way to only allow a person to book one time slot per day?

    • wahab

      william sir ,,,,this is posislbe just in db call person id and change select query with where condition.e.g….
      select * from booking diary where person_id = $p_id.

  • steve

    Hi there,

    Great script. Where would I insert this code to have the email sent to me?
    I tried inserting it in a couple of places to no avail.

  • Joe

    Hi sir,

    Great work sir. Can i ask something. If i want to make booking slot for multiple rooms and i want to create a dropdown list to choose the specific room.How i can retrieve the value and then parse the value by inserting to the sql. I’m new in php and Object Oriented so it kind difficult. Can you give some help here sir. sorry for my poor english.

    • Pramudith Thenabadu

      I have the same question multiple bookings per same slot…

  • markzipps

    Is it possible to change the code slightly to allow for a 24hr booking for two times of day. For example, 10am to 10am and 5pm to 5pm. I can get away with the single time by having one start time and adding 1440 minutes to the booking frequency. It would also need to store a booked slot for the following day if the 5pm slot was taken. Does this make sense?

  • sohail

    Hi, I am getting error message: “Fatal error: Call to undefined method booking_diary::after_post()” when I log into a calendar page. How can I fix this? Thanks

  • vinod kumar

    Thank you very much….its awesome

  • kaushik

    hi planetphp,
    i have just completed my UG in CSE, I also want to develop some applications in PHP.
    since Im not familiar with php i seeked the help of internet and found some applications and decided to develop by myself but i found it difficult. So my question is how long practice will i require to become a professional. i know my question is bit weird

    • Planetphp

      Not an easy question to answer… I’d learn some HTML and some basic Javascript before learning PHP. Learning a programming language can easily turn into an obsession and eat up all your time… I would google “Code Academy” if you are new to programming. It’s a great place to start. Good luck!

  • kaushik

    why im getting a blank screen
    someboby pls help me

  • Jan Robinson Murby

    hi hun im look at also putting a date picker in which file did you put it in hun x

  • Pramudith Thenabadu

    Great script, thanks..
    Question: what if i want to make 2 bookings available per each slot.. how do i do it?

  • Pramudith Thenabadu

    same question… how do i d o it??

    • wahab

      sir simply store time slot in db with respect to user_id means make another field of user_id in db booking diary.
      if another user come its open for it

  • Ian


    Can this handle multiple bookings as well as different prices, for example if a event is on a Wednesday it is £10 and if a event is on a Thursday it is £7.50

    Also can PayPal be integrated into it as well and also can discounts be put into it

  • Clayton Rossiter

    Hi PlanetPHP,
    Downloaded your file and think it looks great! However, rather than booking time slots, I’m looking to produce a booking form for a guest house, so rather than booking time slots, I want it to display which nights people would like to stay. Is there a quick way to bypass the requirement of choosing time slots and choose dates instead?
    Many thanks

  • Rene

    How I can make the calendar in Spanish language?

    • Planetphp

      Okay two things:

      1. Add “setlocale(LC_ALL, ‘ca_ES’);” without the quote marks to class_calendar.php just above the “class booking_diary {” line.

      2. In the “calendar_top” method, line 216, change to:

      “” . ucwords(strftime(“%A, %Y”, $this->selected_date)) . ”

      I did this on my test system and I now get Dimecres, 2016 instead of June 2016. Is that what you wanted?

  • Amman

    Hi sir,
    Thanks and i appreciate your work very much. Its help me alot and i am wondering of finding this neat solution. My question is that I want 6 hours for saturday and 8 hours for other working days. Is it possible to limit time slots for one week day?? Please reply as soon as possible

  • wahab

    Sir , this is great work but i want to display specific time of everyday. for example a doctor working monday 10 am to 1 pm and in evening 7 pm to 10pm. how to specify the time of specific day with respect to doctor…. you have make wonderful program but unfortunately it is working for all days. please help me i am very thankful to you………

  • wahab

    just download jquery 1.10.1 and call it in your calander.php

  • josehorse

    you should import first you database in mysql ^_^ because the code has ‘include’ statement so it shows nothing :) hope it helps

  • Paulson Niro

    Hello, thanks a lot of this script booking calendar.
    I just want to ask, if users booking same slot in the same time. Because i don’t want duplicate booking :D
    Do you know how to fix it?

    Thanks Before :)

  • 2 slots

    Is there any chance to change limit of booking slots from 1 to 2? So for one date and same time can be booked 2 times not only one? Thanks

  • drew

    can you send me a link its not working :(

  • Planetphp

    It does work and a lot of other people have commented to that effect. You should be able to do simple fault finding to understand why this is not working on your installation. With such a vague question, I can’t provide any other response…

  • Paulson Niro

    Try this date(‘H:i:s a’)