
Making the Fields required in a Contact Form
if(isset($_POST['submit'])) {
$myemail = "your-email-address@here.com";
$subject = $_POST['subject'];
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$headers = "From:Contact Form <$myemail>\r\n";
$headers .= "Reply-To: $name <$email>\r\n";
echo "Your message has been sent successfully!";
mail($myemail, $subject, $message, $headers);
} else {
echo "An error occurred during the submission of your message";
}
?>
Anyone have any suggestions on what code I could add to make the fields in the above contact form required?
Thanks!
12 Best Affiliate Marketing Tools || Best Email Marketing Tools