Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/309298-syntax-error-unexpected-end/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.