Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP PHP Arrays and Control Structures PHP Conditionals School's Out

I'm getting an error even though my code looks exactly like instructors

When I save and run the script, I'm getting this error: PHP Parse error: syntax error, unexpected 'else' (T_ELSE), expecting end of file in /home/treeho use/workspace/school.php on line 33

But my code seems EXACTLY identical to the instructors (unless I'm missing something because I'm looking too hard.)

MY CODE (FROM LINE 29-40): if (!$firstName || !$lastName) { echo 'Please enter a student name'; } elseif ($currentGrade < 9 || $currentGrade > 12); { echo 'this is only for high school students. Please enter a grade between 9 and 12'; } else { if ($finalAverage < .70) { $messageBody = 'We look forward to seeing you at summer school, beginning July 1st!'; } else { switch ($currentGrade) { case 9: $messagebody ='Congratulations on completing your freshman year in High School! Weโ€™ll see you on September 1st for the start of your sophomore year!'; break;

2 Answers

You've put a ; after your currentGrade elseif. Should just be a {

Thank you