It is giving me this and not changing the header:
Warning: Cannot modify header information - headers already sent by (output started at /home/content/27/10711827/html/contact.php:2) in /home/content/27/10711827/html/contact.php on line 24
Here is the code.
<?php
if (empty($_POST) === false){
$errors = array();
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
if (empty($name) === true || empty($email) === true || empty($message) === true){
$error[] = 'Name, email and message is required!';
} else{
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false){
$errors[] = 'That\'s not a valid email address';
}
if (ctype_alpha($name) === false){
$errors[] = 'Name must only cotain letters';
}
}
if(empty($errors) === true){
mail('houseblendrecords@gmail.com', 'Contact form', '$message', 'From: ' . $email);
header('Location: contact.php?sent');
exit();
}
}