redirect with header() after headers sent

From: Date: Tue, 29 Aug 2000 18:59:49 +0000
Subject: redirect with header() after headers sent
Groups: php.general 
Request: Send a blank email to php-general+get-14306@lists.php.net to get a copy of this message
All - Using the current release of php4 I want to issue a page redirect after the headers have already been sent. Here's the situation. 1) Headers are sent out in a standard site template from an auto_prepend_file directive. 2) During processing of the php code located in the body of the page I trap for and catch an sql error 3) I want issue a header("Location: sqlerr.html") to redirect the user to a standard error page. The problem with this is that because the headers have gone out with the template I prepend to each page I cannot just issue a header() call without getting an error message about 'headers already sent in line blah blah blah.) My first thought was to close the document by echoing an </HTML> tag then do the redirect via header() but this did not work either. How can I handle this situation? I would really prefer not to display the sql errors on the page that I was building because it's hard to tell where in the page the sql error might interrupt the html. The result could be a page with the banner and background color but without text! Not very user friendly when an error occurs. Any thoughts / suggestions / help would be appreciated. -- Scott

« previous php.general (#14306) next »