I have a script that executes perfectly except for it should be redirecting and it doesn't it just completes the script and stays on a blank white page, and I don't even have any echoes or anything.
<?php
session_start();
require ('checkemail.php');
require ('randompass.php');
require ('dbconnectusers.php');
$email = $_POST['email'];
if (check_email_address($email)) {
$query = "SELECT userid FROM users WHERE email = '$email'";
$theresult = mysql_query($query) or die(mysql_error());
$emailcount = mysql_num_rows($theresult);
if ($emailcount ==1){
$password = createRandomPassword();
$pass = sha1($password);
mysql_query("UPDATE users SET password='$pass'
WHERE email='$email'")or die(mysql_error());
$subject = "New Account Password";
$msg_body .= "Your password has been reset. Please see below for details.\n";
$msg_body .= "Please Change your password to something easier to remember upon logging in.\n";
$msg_body .= "\n";
$msg_body .= "Password: $password\n";
$msg_body .= "\n\n";
$msg_body .= "www.site.com\n";
$headers = 'From: email@mysite.com' . "\r\n";
mail($email, $subject, $msg_body, $headers);
$_SESSION['report'] = 'Success, You\'ve got mail!';
header('Location: forgot.php');
} else {
$_SESSION['report'] = 'This E-mail Addresses doesn\'t exist.';
header('Location: forgot.php');
}
}else {
$_SESSION['report'] = 'This E-mail Addresses is not valid.';
header('Location: forgot.php');
}
?>