Hello PHP and web enthusiasts, I am having a problem with my php code when making a simple email page. The error i am getting is syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier on line 19. Here is my code. I've been trying to fix it for days.
<html>
<h1> Contact Form </h1>
<form action ="HW2-4.php?action=send"method="POST">
<p> Name: <input type="text" name="name" /></p>
<p>Email: <input type="text" name="email" /></p>
<p>Subject: <input type="text" name="subject" /></p>
<p>Message: <textarea col="20" row="5" name="message" ></textarea></p>
<input type="submit" value="Send Email"/>
<?php
if(isset($_POST['action']) and $_POST['action'] == "send"){
$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$headers = $_POST["headers"];
if (mail($email, $subject, $message, $headers) == 1) {
echo "<h3>Hello ".$_POST['name']." An email has been sent to you at ".$_POST['email']."!</h3>";
}
}
The page loads, but the echo statement is not showing up after email is sent and i dont think the email is sending.