Jump to content

Unexpected $end?


twilitegxa

Recommended Posts

Can anyone tell me what is causing the error unexpected $end? (Parse error[/size]: syntax error, unexpected $end in[/size] [/size]/home/content/13/6397313/html/annuities.php[/size] [/size]on line[/size] [/size]54):

 

 


<?php


if(isset($_POST['submit'])) {
if(trim($_POST['name']) == '') {
	$hasError = true;
} else {
	$name = trim($_POST['name']);
}$phone = $_POST["phone"];
if(trim($_POST['email']) == '')  {
	$hasError = true;
} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
	$hasError = true;
} else {
	$email = trim($_POST['email']);



if(trim($_POST['message']) == '') {
	$hasError = true;
} else {
	if(function_exists('stripslashes')) {
		$comments = stripslashes(trim($_POST['message']));
	} else {
		$comments = trim($_POST['message']);
	}
}
if(!isset($hasError)) {
	$emailTo = 'lizkula@webdesignsbyliz.com'; 
	$subject = 'More Information Request : Annuities';
	$body = "Name: $name \n\nEmail: $email \n\nPhone: $phone $comments";
	$headers = 'From: tominsurance.com <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;


	mail($emailTo, $subject, $body, $headers);
	$emailSent = true;
}
}
?>
<?php if(isset($hasError)) {  ?>
	<p class="error">Please check if you've filled all the fields with valid information. Thank you.</p>
<?php } ?>


<?php if(isset($emailSent) && $emailSent == true) { ?>
	<p><strong>Email Successfully Sent!</strong></p>
	<p>Thank you <strong><?php echo $name;?></strong> for requesting more information from us! Your email was successfully sent and we will be in touch with you soon.</p>
<?php } ?>


<html>
<head>
<meta http-equiv="Refresh" content="4;url=annuities.html">
</head>
<body> </body>
</html>

Link to comment
Share on other sites

Probably missing a closing } somewhere.

 

	} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
	$hasError = true;
} else {
	$email = trim($_POST['email']);



if(trim($_POST['message']) == '') {

 

To be helpful, you don't have to even use curly braces if there's only one 'line' being used in an IF/THEN statement. For example, this is fine code

 

if( $a = $b ) echo 'A is B';
elseif( $a = $c )
someFunction( $arguments );
else die( 'foobar' );

Link to comment
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.