Redirect after headers have been sent without user intervention.

Is there any way to redirect to another script after headers have already been sent? I would like to do this without the user having to click on a link or any other action.

Thank you for any help you can provide.

There are 2 ways
the MetaTag method

<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html">

the 0 in content is the number of seconds to wait before redirect. So you can display a message. This should be in the HEAD section of the HTML document.
the javascript method
More info Here

Thanks, Laffin. What I was actually looking for is a way to redirect out to another script after I’m waaaay down from the HEAD section of the document.

I looked at the javascript method that you provided a link to. Would I be able to imbed that javascript code in my PHP script at the point I want out?

Thanks,
Roy

I tried the one of the javascript examples at the Tizag.com tutorial and it worked just fine. Embedded the script 400+ lines into the php code and it redirected me right where I wanted to go.

Thanks a bunch, Laffin!

Roy

The code I used was:

[code]
}
?>
// redirect to search3.php to send out operator emails.

<? } ?> [/code]
Sponsor our Newsletter | Privacy Policy | Terms of Service