I’m trying to resolve an error, but I’m still pretty new to PHP and I’m not sure how to correct what’s wrong, because I simply don’t see what’s wrong. I’m getting an parse error that says, “Parse error: syntax error, unexpected T_STRING on line 147
The code is:
[code=php] <?php
if (empty($_POST)) {
print “<p>Your data failed to submit. Please reattempt. Contact the administrator at [email protected] if failure continues to occur.</p>”;
print “</body></html>”;
exit();
}
function clear_user_input($value) {
if (get_magic_quotes_gpc()) $value=stripslashes($value);
$value= str_replace( “n”, ”, trim($value));
$value= str_replace( “r”, ”, $value);
return $value;
}
if ($_POST[‘comments’] == ‘Feel free to be open and honest. Share what you think.’) $_POST[‘comments’] = ”;
$body =”The user submitted the following information:n”;
foreach ($_POST as $key => $value) {
$key = clear_user_input($key);
$value = clear_user_input($value);
if ($key==’extras’) {
if (is_array($_POST[‘extras’]) ){
$body .= “$key: “;
$counter =1;
foreach ($_POST[‘extras’] as $value) {
//Add comma and space until last element
if (sizeof($_POST[‘extras’]) == $counter) {
$body .= “$valuen”;
break;}
else {
$body .= “$value, “;
$counter += 1;
}
}
} else {
$body .= “$key: $valuen”;
}
} else {
$body .= “$key: $valuen”;
}
}
extract($_POST);
$email = clear_user_input($email);
$name = clear_user_input($name);
$from=’From: ‘. $email . “(” . $name . “)” . “rn” . ‘Bcc: [email protected] . “rn”;
$subject = ‘LMCO Contact Form’;
mail (‘[email protected]’, $subject, $body, $from);
?>
Line 147 being the $subject = ‘LMCO Contact Form’;