function isDateEmpty() {
if (empty($_POST['birthday_day'])) return true;
if (empty($_POST['birthday_month'])) return true;
if (empty($_POST['birthday_year'])) return true;
return false;
}
if (isDateEmpty()) {
set_message(WRONG_DATE);
return false;
}
try {
$birthday = new DateTime($_POST['birthday_day'] . "-" . $_POST['birthday_month'] . "-" . $_POST['birthday_year']);
} catch (Exception $e) {
set_message(WRONG_DATE);
return false;
}