Page 1 of 1

Contact Form Trouble

Posted: Fri Apr 30, 2010 12:37 pm
by cbaskauskas
Hello, I am trying to get a contact form to work (http://businesscalcium.com/contact.html) but when the form submits I get an error "Parse error: syntax error, unexpected T_STRING in /var/www/web3/web/contactengine.php on line 42"

Here's the code for contactengine.php:

Code: Select all

<?php

// CHANGE THE THREE VARIABLES BELOW

$EmailFrom = "***email removed***";
$EmailTo = "***email removed***";

$Name = Trim(stripslashes($_POST['name']));
$Email = Trim(stripslashes($_POST['email']));
$Company = Trim(stripslashes($_POST['company']));
$Phone = Trim(stripslashes($_POST['phone']));
$Subject = Trim(stripslashes($_POST['subject'])); 
$Message = Trim(stripslashes($_POST['message'])); 

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Company: ";
$Body .= $Company;
$Body .= "\n";
$Body .= "Subject: ";
$Body .= $Subject;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
// CHANGE THE URL BELOW TO YOUR "THANK YOU" PAGE
if ($success){
  print "<meta http-equiv="refresh" content="0;URL=contactthanks.html">";
}
else{
  print "<meta http-equiv="refresh" content="0;URL=error.html">";
}
?>
Anybody know what's causing the syntax error?

Re: Contact Form Trouble

Posted: Fri Apr 30, 2010 12:49 pm
by mikosiko
check your " usage in this lines... they are wrong

Code: Select all

  print "<meta http-equiv="refresh" content="0;URL=contactthanks.html">";
}
else{
  print "<meta http-equiv="refresh" content="0;URL=error.html">";
}

Re: Contact Form Trouble

Posted: Fri Apr 30, 2010 12:52 pm
by cbaskauskas
hmm i'm not very experienced with php. do i need to insert some slashes into those lines?

Re: Contact Form Trouble

Posted: Fri Apr 30, 2010 4:17 pm
by geoffmuskett
\ escapes characters that php might interpret like " and ;