headingmust be called before any output goes to the browser for proper operation, even I do not see all the code. I see that you are outputting an empty string to:
?>
<?php
delete all such places and possible others where the exit can be performed - then the redirection will work
Also, I really suggest you use the correct redirection:
function redirect($url)
{
if (!headers_sent())
{
if (strtoupper($_SERVER['SERVER_PROTOCOL']) == 'HTTP/1.1')
@header('HTTP/1.1 303 See Other', true, 303);
else
@header('HTTP/1.0 302 Found', true, 302);
@header('Location: ' . $url);
@header('Content-type: text/html');
}
echo '<html><head><title>Redirect</title><meta http-equiv="Refresh" content="0;URL='.htmlspecialchars($url).'"></head><body>'.
'<a href="'.htmlspecialchars($url).'">Click here</a>'.
'</body></html>';
@ob_flush();
exit();
}
source
share