Php send mail error

Can anyone help, im setting up an email form and it is returning this error.

Parse error: syntax error, unexpected ‘isInjected’ (T_STRING), expecting ‘(’ in /storage/ssd4/339/5596339/public_html/send_mail.php on line 21

Html code:

<form action="send_mail.php" method="post">
<p><br>
<input name="Name" type="text" style="width: 325px; height: 40px" placeholder="Your Name *" required><p>
<input name="Email" type="text" style="width: 325px; height: 40px" placeholder="Email Address *" required<p>
<input name="Telephone" type="text" style="width: 325px; height: 40px" placeholder="Telephone Number *" required><p>
<select name="Type" style="width: 325px; height: 40px" required>
<option value="" disabled selected>Type of Move *
</option>
<option value="Home Move Only">Home Move Only</option>
<option value="Business Move Only">Business Move Only</option>
<option value="Home Move and Storage">Home Move and Storage</option>
<option value="Business Move and Storage">Business Move and Storage</option>
<option value="General Move">General Move</option>
</select><p>
<input name="From" type="text" style="width: 325px; height: 40px" placeholder="Moving From (Postcode) *" required><p>
<input name="To" type="text" style="width: 325px; height: 40px" placeholder="Moving To (Postcode) *" required><p>
<button name="Abutton1" style="width: 325px; height: 40px;" class="btn1" type="submit" value="Submit">Submit
</button>
<p align="left">
<input name="Checkbox1" type="checkbox" required><span class="style7">I  accepted.</span></form>

PHP Code
<?php
$webmaster_email = "email@hotmail.co.uk";
$feedback_page = “feedback_form.html”;
$error_page = “error_message.html”;
$thankyou_page = “thank_you.html”;
$Email = $_REQUEST[‘email’] ;
$Telephone = $_REQUEST[‘Telephone’] ;
$Name = $_REQUEST[‘Name’] ;
$Type = $_REQUEST[‘Type’] ;
$From = $_REQUEST[‘From’] ;
$To = $_REQUEST[‘To’] ;
$Checkbox1 = $_REQUEST[‘Checkbox1’] ;
$msg =
"Name: " . $Name . “\r\n” .
"Email: " . $Email . “\r\n” .
"Telephone: " . $Telephone . “\r\n” .
"Type: " . $Type . “\r\n” .
"From: " . $From . “\r\n” .
"To: " . $To . “\r\n” .
"Checkbox1: " . $Checkbox1 . “\r\n” .
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;
}
}
if (!isset($_REQUEST[‘Email’])) {
header( “Location: $feedback_page” );
}
elseif (empty($Name) || empty($Email)) {
header( “Location: $error_page” );
}
elseif (empty($Name) || empty($Email) || empty($Telephone) || empty($Type) || empty($From) || empty($To)) {
header( “Location: $error_page” );
}
else {
mail( “$webmaster_email”, “Feedback Form Results”, $msg );
header( “Location: $thankyou_page” );
}
?>

Please help

Aren’t you missing a semicolon ; before function isInjected()?

tried that didn’t work

Your code is incorrect try using this code
$injections = array('/(\n+)/i',

1 Like