3
Regular expression check for date.
6
// check if the dates are valid:
7
if(! preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $_POST[EndDate])){
9
$EndDateunset = 'style="background-color: yellow;" ';
11
$errorMsg = $errorMSG."the end date string must be YYYY-MM-DD .<br />";
15
if(! preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $_POST[StartDate])){
17
$StartDateunset = 'style="background-color: yellow;" ';
19
$errorMsg = $errorMsg."the start date string must be YYYY-MM-DD .<br />";
22
//end of check if dates are valid
23
//TODO: need more teisting.
24
if($_POST[StartDate] > $_POST[EndDate]){
26
$errorMsg = $errorMsg."End date is smaller then startdate .";
29
//TODO: Add check for if dates are in DB.