I'm trying to implement a form submission feature on my website using PHP, but I'm getting the following error: 'PHP Parse error: syntax error, unexpected '$_POST' (T_VARIABLE) in /path/to/file.php on line 12'. Here is the relevant code:
I'm not sure what's causing this error. Can anyone help me figure out what's going wrong and how I can fix it?"
Code:
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "myemail@example.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
}