Forum Moderators: coopster

Message Too Old, No Replies

Can I output html and still use header()?

         

TravelSite

7:49 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



I have a php script running on my localhost which on completion redirects to another script (itself actually - but with different parameters) using header(). It takes about 10 seconds for each script/page to load/run. Is there any way I can output some text without stopping header() from working? Thanks.

chrisjoha

8:43 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



I guess you could write some text to a file or database, and inspect the results of that if you need to know what's going on before the redirect.

mcibor

9:02 pm on Aug 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To output something to user I don't know if flush() will do the job, but you can try.
However then the headers might not work. If that happens, just use javaScript redirect:

<script language="JavaScript" type="text/javascript">
<!--
rtime = 5000;
rurl = "index.html";

function my_redirect()
{
self.setTimeout("self.location.href = rurl;", rtime);
}
//-->
</script>

Hope this helps
Michal Cibor