Good afternoon all; First time poster and really new to php and HTML.
I am starting to maintain application that has departure date and return date. There are edits to insure return date is not less than departure date and that is working fine.
dates are dropdowns in mmm dd yyyy format. I need to determine if departure date is greater than today. If it equal to or less than today, then no deposit but if it is greater than today, I want to collect a deposit.
departure date code is:
$depDay = $SESSION['reservation']['req_depday'];
$depMonth = $SESSION['reservation']['req_depmonth'];
$depYear = $_SESSION['reservation']['req_depyear'];
$depStrDate = sprintf ( "%02d/%02d/%04d", $depMonth, $depDay, $depYear );
$depDate = strtotime ( $depStrDate );
I put the following code in and I am getting the opposite results of what I expected:
$now = getdate ();
if ( $depDate > $now )
{
$SESSION['error_msg'] = $errfontopen;
$SESSION['error_msg'] .= 'Pickup Date is greater than today - get a deposit!';
$_SESSION['error_msg'] .= $errfontclose;
header ( 'location: ../rs01L.php?ren_id=' . $_REQUEST['ren_id'] );
exit;
}
if ( $depDate < $now )
{
$SESSION['error_msg'] = $errfontopen;
$SESSION['error_msg'] .= 'Pickup date is equal to or less than today - no deposit' ';
$SESSION['error_msg'] .= $errfontclose;
header ( 'location: ../rs01L.php?ren_id=' . $REQUEST['ren_id'] );
exit;
}
Any help with this would be greatly appreciated! Kevin