Hi I have a simple form with two email entries and two date entries.
I need to know the length in days between the dates.
I have written a server-side validation in php.
I have written it in PHP because I cannot get a javascript version to work...my own incompetance !
While I have the dates in the mktime form I would like to calculate the length as
But having got that I would like to put it together with the other form elements into the database.
Q 1. How do I do that. ?
Q 2. Should I really use javascript ?? if so how?
I am making slow progress from a posiition of total ignorance.
--
Dave
I need to know the length in days between the dates.
I have written a server-side validation in php.
<?php
$date3bits = explode('-', $_POST['date_3']);
$firstdate = mktime(0,0,0,$date3bits[1],$date3bits[2],$date3bits[0]);
$date4bits = explode('-', $_POST['date_4']);
$lastdate = mktime(0,0,0,$date4bits[1],$date4bits[2],$date4bits[0]);
$today = time();
if (($today > $firstdate) || ($firstdate > $lastdate)){
return "You cannot book before today and the last date cannot be before the first date";}
else if ($_POST['text_1'] != $POST['text_2'])
{
return "Your email entries do not match";
}
?>
I have written it in PHP because I cannot get a javascript version to work...my own incompetance !
While I have the dates in the mktime form I would like to calculate the length as
$length = ($lastdate - $firstdate)/ (60*60*24) + 1; //the length of hire
But having got that I would like to put it together with the other form elements into the database.
Q 1. How do I do that. ?
Q 2. Should I really use javascript ?? if so how?
I am making slow progress from a posiition of total ignorance.
--
Dave