This contact.php form was working to handle a submit and then redirect to a new page and then all of a sudden just stopped working. I have tried adding error handling and also moving header to the top in front of all other, but neither works. The form is still submitting the data as expected, it's just the redirect that doesn't work. Any ideas would be appreciated.
<?php
include 'config.php';
$post = (!empty($_POST)) ? true : false;
if($post)
{
$email = trim($_POST['email']);
$subject = "Downloaded Course Units";
$error = '';
if(!$error)
{
$mail = mail(WEBMASTER_EMAIL, $subject, $message,
"From: ".$email."\r\n"
."Reply-To: ".$email."\r\n"
."X-Mailer: PHP/" . phpversion());
if($mail)
{
echo 'OK';
header('location: http://www.google.com.au/');
exit();
}
}
}
?>