Jump to content

[SOLVED] Booking on Calendar


zed420

Recommended Posts

Hi All

Can someone please help me with this code all I'm trying to do is book driving lessons online via Calendar.  So if someone hits on passed date,month or year he/she gets message 'The date has passed' else they can book their lesson on clicked day. There are NO errors on script but it not working right.

thanks

Zed

<?php
$day = $_GET['day'];
$cMonth = $_GET['cMonth'];
$cYear = $_GET['cYear'];
$today = date("j");
$month = date("n");
$year = date("y");

if (($day < $today)&&($cMonth <= $month)){
echo "<p>This date has Passed, Please choose another</p>";
}elseif (($cMonth < $month)&&($cYear <= $year)){
echo "<p>This date has Passed, Please choose another</p>";
}elseif (($cMonth >= $month)&&($cYear >= $year)){
echo "You are about to book a lesson for <div class=\"everyday\">$day $cMonth $cYear</div>";
}else{
echo "You are about to book a lesson for <div class=\"everyday\">$day $cMonth $cYear</div>";	
  }
?>

Link to comment
Share on other sites

Here you go, this one doesn't let you book for today but I DON'T want the error if its same day. I want it so the people can book it for the same day.

 

thanks for all this Zed

 

$day = $_GET['day'];
$cMonth = $_GET['cMonth'];
$cYear = $_GET['cYear'];
$today = time();
$request_date = mktime(0,0,0,$cMonth,$day+1,$cYear)-1; //add 1 day subtract 1 second 
if($today > $request_date)
{
echo "Error, Post date"; // post date
}else{
echo 'You are about to book a lesson for <div class="everyday">'.date('j F Y', $request_date ).'</div>';
}

Link to comment
Share on other sites

Works okay here, try this (forcing the values to today)

<?php
date_default_timezone_set('GMT');

$day = $_GET['day'];
$cMonth = $_GET['cMonth'];
$cYear = $_GET['cYear'];

//Debug
$day = 10;
$cMonth = 8;
$cYear = 2009;
//End debug

$today = time();
$request_date = mktime(0,0,0,$cMonth,$day+1,$cYear)-1; //add 1 day subtract 1 second 
if($today > $request_date)
{
   echo "Error, Post date"; // post date
}else{
   echo 'You are about to book a lesson for <div class="everyday">'.date('j F Y', $request_date ).'</div>';
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.