Hi guys, hope you're okay.
I have just implemented a new system, and hoped you can double check some validation for me.
Basically, the dates below are stored as yyyy-mm-dd, and I want to:
That stageend is not before stagestart
Stageend is not before r2 or r1
r2 is not before r1
And none of the above below stagestart (must be the first date)
Also, it would be great to check that none of the dates are in the past, but allow today
Any idea how I can achieve the above? So far I've got the following. I tried the one about checking not in the past, but it always disallowed today's date which it needs to allow 🙁
Any help appreciated, thank you.
$stagestart = strtotime($_POST['stagestart']);
$r1 = strtotime($_POST['r1']);
$r2 = strtotime($_POST['r2']);
$stageend = strtotime($_POST['stageend']);
if ($r1>=$r2)
{
$write=0;
$msg .= "<li><span>The r 2 cannot be before r 1</span></li>\n";
}
if ($stagestart>=$stageend)
{
$write=0;
$msg .= "<li><span>The stage end cannot be less than stage start</span></li>\n";
}