how to show a simple htm page and redirect to another one?

gesf

New member
Use this in your <head></head> tag:
Code:
<meta http-equiv="refresh" content="10;url=http://www.site.com">
Replace http://www.site.com with the url you want to redirect to!
 
oOomen said:
hi, i'm newbie, can some one show a simple example how to show a simple htm page than wait 10 sec. and redirect to another page?
I think i´ve asked your question :D
If you want to redirect one page to another one with php, you have to use header(), like you said:
PHP:
header("Location: http://bla-bla.com");
If you still want to redirect it after 10 sec., you can use sleep(), like:
PHP:
sleep(10);
header("Location: http://bla-bla.com");
If you´re getting an error like:
Code:
Warning: Cannot modify header information - headers already sent by (output started at ....
You can make (Without sleep() this time):
PHP:
print('<meta http-equiv="refresh" content="10;url=http://www.site.com">');
I suggest you to use javascript or even html as much as you can for client-side stuff!!
 
As gesf's last post implies, you can't do anything on the client side with PHP. All you can do is send text to the client, and once you're done sending that text, you can't do anything else. The only way to make anything happen on the client side is with JavaScript or the META refresh that gesf suggested.
 
Back
Top