BIGB185 Posted September 29, 2019 Share Posted September 29, 2019 I'm having an issue with a small bit of code I'm writing for a class. Below is the code I have and at line 30, dreamweaver gives me the error "syntax error, unexpected $end" <!DOCTYPE html> <html lang="en-US"> <head> <title>Homework 2 - Simple PHP page</title> </head> <body> <?php if($_POST['firstName'] == NULL || $_POST['quantity'] == NULL || $_POST['gender'] == NULL || $_POST['sport'] == NULL) { echo "<h1>Please return to the form and fill out completely</h1>"; } else { ?> <?php echo "<h2>Welcome ".$_POST["firstName"]."</h2>"; if($_POST['gender']=='male' &$_POST['sport']=='gymnastics') { echo " Real men don't like gymnastics!<br/>"; } else if($_POST['gender']=='female' &$_POST['sport']=='football') { echo "Women are too delicate for a rough sport like football!<br/>"; } $cost = $_POST['quantity'] * 4.95 * 1.08 + 5.99; ?> *LINE 30* <p>You have ordered <?php echo $_POST['quantity'] . " " . $_POST['sport'] . " mugs at a cost of $" . number_format($cost, 2); ?>. Thank you.</p> <p> } </body> </html> I can't seem to figure out what I've done wrong, any help would be appreciated, thank you. Quote Link to comment https://forums.phpfreaks.com/topic/309298-syntax-error-unexpected-end/ Share on other sites More sharing options...
benanamen Posted September 29, 2019 Share Posted September 29, 2019 (edited) You have a parenthesis floating outside of Php just above the closing body tag. Edited September 29, 2019 by benanamen Quote Link to comment https://forums.phpfreaks.com/topic/309298-syntax-error-unexpected-end/#findComment-1570050 Share on other sites More sharing options...
BIGB185 Posted September 30, 2019 Author Share Posted September 30, 2019 Thank you, benanamen. I have no idea why I didn't see that. lol Quote Link to comment https://forums.phpfreaks.com/topic/309298-syntax-error-unexpected-end/#findComment-1570068 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.