Hi,
I seem to be having problems with nesting conditionals. I have followed through the steps in the book, but have come across the following error:
Parse error: syntax error, unexpected 'else' (T_ELSE) in /Applications/MAMP/htdocs/sites/PHPbook/Chapter6/handle_reg.php on line 39
Line 39 relates to the second else statement. What have I done wrong?
if ( is_numeric($_POST['year']) AND (strlen($_POST['year']) == 4) ) {
if ($_POST['year'] < 2017) {
$age = 2017 - $_POST['year'];
} else {
print '<p class="error">Either you entered your birth year wrong or you come from the future!</p>';
$okay = false;
} else {
print '<p class="error">Please enter the year you were born as four digits.</p>';
$okay = false;
}
}