Hi
Despite the fact I have a 75 IQ on a good day I have started making a PHP form. Feels like I'm sooooooo close. Can anyone help me?
Here is the PHP (Error Msg to follow🙂
<?php
// This function checks for email injection.typically used by spammers to inject a CC list.
function isInjected($str) {
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str)) {
return true;
}
else {
return false;
}
}
// Load form field data into variables.
$FirstName = $_REQUEST['FirstName'] ;
$MiddleInitial = $_REQUEST['MiddleInitial'] ;
$LastName = $_REQUEST['LastName'] ;
$Address = $_REQUEST['Address'] ;
$AptSuiteFloor = $_REQUEST['AptSuiteFloor'] ;
$City = $_REQUEST['City'] ;
$State = $_REQUEST['State'] ;
$ZipCode = $_REQUEST['ZipCode'] ;
$PhoneNumber = $_REQUEST['PhoneNumber'] ;
$EMailAddress = $_REQUEST['EMailAddress'] ;
$Age = $_REQUEST['Age'] ;
$PME = $_REQUEST['PME'] ;
$ATV = $_REQUEST['ATV'] ;
$Rifle = $_REQUEST['Rifle'] ;
$Supplies = $_REQUEST['Supplies'] ;
$Phone = $_REQUEST['Phone'] ;
$Land = $_REQUEST['Land'] ;
$Comments = $_REQUEST['Comments'] ;
// If the user tries to access this script directly, redirect them to feedback form,
if (!isset($_REQUEST['EMailAddress'])) {
header( "Location: form.html" );
}
// If the form fields are empty, redirect to the error page.
elseif (empty($FirstName) || empty($LastName) || empty($Address) || empty($City) || empty($State) || empty($ZipCode) || empty($PhoneNumber) || empty($EMailAddress) || empty($Age) || empty($PME) || empty($Land)) {
header( "Location: errormsg.html" );
}
// prepare email body text
$Body = "New Applicant for Elder Army:";
$Body .= "\n";
$Body .= "First Name: ";
$Body .= $FirstName;
$Body .= "\n";
$Body .= "M: ";
$Body .= $MiddleInitial;
$Body .= "\n";
$Body .= "Last Name: ";
$Body .= $LastName;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $Address;
$Body .= "\n";
$Body .= "ASF: ";
$Body .= $AptSuiteFloor;
$Body .= "/n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "State: ";
$Body .= $State;
$Body .= "\n";
$Body .= "Zip: ";
$Body .= $ZipCode;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $PhoneNumber;
$Body .= "\n";
$Body .= "E Mail: ";
$Body .= $EMailAddress;
$Body .= "\n";
$Body .= "Age: ";
$Body .= $Age;
$Body .= "\n";
$Body .= "PME: ";
$Body .= $PME;
$Body .= "\n";
$Body .= "ATV: ";
$Body .= $ATV;
$Body .= "\n";
$Body .= "Rifle: ";
$Body .= $Rifle;
$Body .= "\n";
$Body .= "Supplies: ";
$Body .= $Supplies;
$Body .= "\n";
$Body .= "Cell: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Land: ";
$Body .= $Land;
$Body .= "\n";
$Body .= "Comments: ";
$Body .= $Comments;
$Body .= "\n";
}
// If we passed all previous tests, send the email!
else {
mail( "example@example.com", "Feedback Form Results", $Body, "From: $EMailAddress" );
header( "Location: thankyou.html" );
}
?>
This is the error message I get when I run it:
Parse error: syntax error, unexpected '}' in /hermes/bosweb/web187/b1872/ipg.raabsurdum/sendmail.php on line 109
$Body .= $Comments;
Please help me. Everything else appears to work great on the PHP.
Thanks
Captain Kirk