PHP header location redirect causing 500 Internal Server error

Posted by Globalz on Stack Overflow See other posts from Stack Overflow or by Globalz
Published on 2010-05-09T13:28:03Z Indexed on 2010/05/09 13:28 UTC
Read the original article Hit count: 266

Filed under:
|
|
|
|

Hi, I I keep getting a 500 Internal Server Error when the script below reaches the header('location:php_email_thankyou.php'). Im not sure what is causing this, as I can place the header expression before or after the if statements and it works fine. In firebug it mentions a GET request for the php_email_thankyou.php page not sure if that means anything...

<?php

ini_set('display_errors', 'On');   
error_reporting(E_ALL | E_STRICT);    

include('php/cl/cl_val.php');  
$val = new Validate;  
$print_errors = false;  

if (isset($_POST['email(email)'])){  
    if(isset($_SERVER['HTTP_X_REQUESTED_WITH']))  
    {  
        $validation = $val->clean($_POST);  
        if (isset($validation['send']))   
        {  
            header('location:php_email_thankyou.php');  
            exit();  
        }  
        else   
        {  
            print json_encode($validation);  
            exit();  
        }  
    }   
    else   
    {  
        $validation = $val->clean($_POST);  
    }  
}  

?>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  

Thanks heaps!

© Stack Overflow or respective owner

Related posts about php

Related posts about redirect