header('location: foo.php');
is not working for me. the page that is supposed to redirect just dies. no error, no redirect, no nothing.
this is the code in my main file:
if ($payment_required == 0) {
$log->write('NO PAYMENT REQUIRED, REDIRECTING TO post_thanks.php');
jta_redirect('post_thanks.php');
} else {
// do shopping cart addition code and link out to paypal
die('extra ' . $payment_required . ' worth of features requested...handle it');
}
here is the function jta_redirect():
function jta_redirect($url) {
global $session;
global $log;
$file = '';
$line = '';
if (headers_sent($file, $line)) {
die('Unable to redirect. headers already sent in file ' . $file . ' on line ' . $line . '.');
}
$log->write(' headers:' . headers_sent());
$url = $session->add_sid($url);
$log->write('attempting redirect, url:' . $url);
header('location: ' . $url);
exit();
} // jta_redirect()
this is what results in the log:
NO PAYMENT REQUIRED, REDIRECTING TO post_thanks.php
attempting redirect, headers:
attempting redirect, url:post_thanks.php
What might be the story here? What might cause a header() redirect no to work? it works most of the time, but if the browser window has remained open for a few minutes, it often doesn't work.