Forum Moderators: coopster

Message Too Old, No Replies

redirecting problem

         

dbarasuk

10:25 pm on Mar 30, 2008 (gmt 0)

10+ Year Member



Hi!
I always have seen pages with a "Redirecting..." phrase that displays for a couple of seconds before the new page appears. I tried doing:
echo "<p>Redirecting..., please wait!</P>";
header('Location:http://www.something.com');
expecting to see the redirecting message appear for some seconds before i am redirected to the www.something.com but, i never see that message, instead i am immediately redirected.

How can I make that happen?

regards!

ichsie

1:18 am on Mar 31, 2008 (gmt 0)

10+ Year Member



php header should be sent before any output is rendered to browser, so you will get rid of the echo before the header() to make it work.

kunwarbs

7:39 am on Mar 31, 2008 (gmt 0)

10+ Year Member



you may want to use sleep() function to hold the redirection directive for few seconds so that the redirection message can be displayed.

[in2.php.net...]

cameraman

9:05 am on Mar 31, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PHP is a server side scripting language; nothing will be sent to the browser until the script has finished executing.
To do the phrase you could either do a meta redirect or use javascript.