Jump to content
Larry Ullman's Book Forums

Beginner Bob

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Beginner Bob

  1. I see it now, feeling pretty stupid. I checked it over 20 times! Thanks for the reply. Thanks for the tip Necuima, will save me a lot of stress in the future!
  2. 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; } }
×
×
  • Create New...