Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Terminate previous header

Status
Not open for further replies.

rejoice

MIS
Jun 5, 2002
42
0
0
MY
Can anyone know how to terminate previous header that has been sent out half way, and then use header() to direct the user to another URL?
 
I don't understand what you mean by "terminate previous header halfway".

A header has either been sent or it has not. If you need to send one of two headers depending on some set circumstances, your code should check for those circumstances before sending headers.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Well, I need to design my own error handler function. Whenever error occur, I hope this function not only can keep the error log, but also direct user to another page.

I tried to put header() in this function, but in some cases, it popup the message saying the header already been sent.

function myErrHandler(...) {
...blah...
header("Location: error.html");
}
set_error_handler("myErrHandler");

I just wonder whether I can terminate the previous header and send another header to direct it to another page.

TQ
 
once header are sent you can not send another header...

You sould write an error handler in order to check the page before send it...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top