SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Threaded View

  1. #1
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help Me With Php The Checks Start Date And End Date

    Hello,
    May someone help me with a a php script or date calander that will enable users of the form to pick or select the start and end date. The start date should be equal to the current or future date and end date should be equal to start date or future date.
    Have come have scripts below but is not working properly.
    The date is being picked or selected using javascript calander, when I submit it gives error.
    The script is as follows,

    $tDepartureDatett =$_POST["Departure_Date"];//start date
    $tReturnDatett =$_POST["Return_Date"];// end date

    $tDepartureDate=date("$tDepartureDatett");
    $tReturnDate=date("$tReturnDatett");

    $testDate=(($tDepartureDate>=$dtoday) and($tReturnDate>=$tDepartureDate));

    if($testDate==0){
    echo"Check the Dates";
    echo "<br>";
    echo "<br>";
    echo"Departure Date must be today or future date";
    echo "<br>";
    echo "<br>";
    echo"Return Date must be equal to Departure Date or greater";
    echo "<br>";
    echo "<br>";
    echo "<a href=javascript:history.Back()>Back</a>";
    exit;
    }
    elese {

    It does want I want

    }

    Date format is YYYY-MM-DD e.g 2006-09-1



    Iam receiving this error


    Warning: mktime() [function.mktime]: Windows does not support negative values for this function in c:\local\wamp\www\subsistence\test888.php on line 44

    Warning: mktime() [function.mktime]: Windows does not support negative values for this function in c:\local\wamp\www\subsistence\test888.php on line 46

    when I use the scripts below
    of course iam using windows operating system in as webserver


    $dtoday = mktime (0, 0, 0, date ("m"), date ("d"), date ("Y"));

    $tDepartureDatett = $_POST["Departure_Date"];//start date
    $tReturnDatett = $_POST["Return_Date"];// end date

    $tDepartureDate = mktime (0, 0, 0, date ("m",$tDepartureDatett), date ("d",$tDepartureDatett), date ("Y",$tDepartureDatett));

    $tReturnDate = mktime (0, 0, 0, date ("m",$tReturnDatett), date ("d",$tReturnDatett), date ("Y",$tReturnDatett));

    $testDate = ( ($tDepartureDate >= $dtoday) && ($tReturnDate >= $tDepartureDate) );

    if ( !$testDate ) {
    echo "Check the Dates";
    echo "<br>";
    echo "<br>";
    echo "Departure Date must be today or future date";
    echo "<br>";
    echo "<br>";
    echo "Return Date must be equal to Departure Date or greater";
    echo "<br>";
    echo "<br>";
    echo "<a href=javascript:history.Back()>Back</a>";
    exit;
    } else {

    so want is the solution


    Your help will be highly appreciated.
    Thanks.
    Last edited by zamzam; Apr 6, 2006 at 04:28.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •