I have a php form that the user fills out and once submitted, I want to redirect the user to a thank you page. It currently just loads to the same page with an error. here is my code..
<?php

$email = $_POST['email'];
$name1 = $_POST['name1'];
$name2 = $_POST['name2'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];

//validate

if(empty($email) || empty($name1) || empty($name2) || empty($address1) || empty($city) || empty($state) || empty($zip)) {
$message = 'Fill in areas in red!';
$aClass = 'errorClass';
}
else {
$cvsData = $email . "," . $name1 . "," . $name2 . "," . $address1 . "," . $address2 . "," . $city . "," . $state . "," . $zip . "\n";
$fp = fopen("twckmf.csv","a");
if($fp){
fwrite($fp,$cvsData);
fclose($fp);
header("Location: http://www.esadvertising.net/twc/kmf/dvd/thankyou.html",TRUE,301);
exit;
}
}
?>