Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP -- unexpected if.... 1

Status
Not open for further replies.

khanza

Technical User
Feb 20, 2003
70
US
Here's my code -
Code:
<html>
<?php
if ($_POST['submit']){
  $to = "enduser@aol.com";
  $subject = $_POST['name'];
  $body = $_POST['name'].",".$_POST['address'].",".$_POST['city'].",".$_POST['zip'].",".$_POST['phone'].",".$_POST['email'].",".$_POST['preference'].",".$_POST['pass']
  if (mail($to, $subject, $body)){
    echo("<p>Message sent!</p>");
  }
  else{
    echo("<p>Message delivery failed...</p>");
  }
}
?>
</html>

Here's my error -
Code:
Parse error: parse error, unexpected T_IF in /home/w/wowzer/.html/php-form-dance/tekconfirm.php on line 7

Any ideas? Thanks guys
 
I forgot a ';' on line 6 --

Thanks guys


Can I delete this post?
 
khanza,

There's no reason to delete the post, others may learn from it in the future. We all made similar mistakes at one time or another.

Generally, I've found that a php error is almost always caused by 1) a missing semicolon, 2) a missing end parenthesis, or 3) one too many or one too few end brackets.

Usually the error line displayed is the line after the error, since that's where the error occurs, but is caused by a syntax error a line above it.

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top