FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP Form Sending problem





Scott
I don't know very much PHP, but I'm trying to set up a survey for a friend. There is an html file with the form and a php file that sends an email. For some reason the php file just gives me the error:

Parse error: syntax error, unexpected '=' in /home/scott/public_html/rugby/contact.php on line 3

Here is the php file, I really can not see the problem. Please help, this is urgent!
Code:
<?php
// get posted data into local variables
$EmailFrom = "xxx@electrn.ca";
$EmailTo = "xxx@gmail.com";
$Subject = "SURVEY";
$Question1 = Trim(stripslashes($_POST['Question1']));
$Question1-Other = Trim(stripslashes($_POST['Question1-Other']));
$Question2 = Trim(stripslashes($_POST['Question2']));
$Question2-Other = Trim(stripslashes($_POST['Question2-Other']));
$Question3 = Trim(stripslashes($_POST['Question3']));
$Question4 = Trim(stripslashes($_POST['Question4']));
$Question4-Specify = Trim(stripslashes($_POST['Question4-Specify']));
$Question5 = Trim(stripslashes($_POST['Question5']));
$Question6 = Trim(stripslashes($_POST['Question6']));
$Question7 = Trim(stripslashes($_POST['Question7']));
$Question8 = Trim(stripslashes($_POST['Question8']));
$Question9 = Trim(stripslashes($_POST['Question9']));
$Question10 = Trim(stripslashes($_POST['Question10']));
$Question11 = Trim(stripslashes($_POST['Question11']));
$Question12 = Trim(stripslashes($_POST['Question12']));

// validation
$validationOK=true;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Question1: ";
$Body .= $Question1;
$Body .= "\n";
$Body .= "Question1-Other: ";
$Body .= $Question1-Other;
$Body .= "\n";
$Body .= "Question2: ";
$Body .= $Question2;
$Body .= "\n";
$Body .= "Question2-Other: ";
$Body .= $Question2-Other;
$Body .= "\n";
$Body .= "Question3: ";
$Body .= $Question3;
$Body .= "\n";
$Body .= "Question4: ";
$Body .= $Question4;
$Body .= "\n";
$Body .= "Question4-Specify: ";
$Body .= $Question4-Specify;
$Body .= "\n";
$Body .= "Question5: ";
$Body .= $Question5;
$Body .= "\n";
$Body .= "Question6: ";
$Body .= $Question6;
$Body .= "\n";
$Body .= "Question7: ";
$Body .= $Question7;
$Body .= "\n";
$Body .= "Question8: ";
$Body .= $Question8;
$Body .= "\n";
$Body .= "Question9: ";
$Body .= $Question9;
$Body .= "\n";
$Body .= "Question10: ";
$Body .= $Question10;
$Body .= "\n";
$Body .= "Question11: ";
$Body .= $Question11;
$Body .= "\n";
$Body .= "Question12: ";
$Body .= $Question12;
$Body .= "\n";

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

// redirect to success page
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
Dougie1
This part here:
Code:
$Question1-Other

is an invalid Variable name.

Remove the '-' from each of your variable names with a dash in them.
Scott
Ah, ok. Thanks.
Related topics
PHP include code problem
PHP homepage recreation problem
Problem with PHP
Uplaoding images using php form :::: Help needed
Php form.
Anyone care to help me with a simple PHP Form ?
anyone know of a good php form processer script
PHP Form Question
PHP login script problem
PHP Form Processing Problem
Help with php email
800$ frih for grab, php form small correction - urgent
php and mysql form
Form handling in php is a pain in the neck
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.