Entry
1. how to redirect from php page to another php page? 2. how to refresh a page?
Feb 22nd, 2008 19:56
dman, urge overkill, Philip Olson, bhavani bhavani, http://www.ttnr.org
To do a refresh, you can use HTML meta tag such as :
<meta HTTP-EQUIV="refresh" content=4;url="example.php">
That'll refresh to example.php in four (4) seconds. It's also worth
mentioning that various predefined variables exist that reflect the
current page, run phpinfo() to see which exist on your system. A
commonly used one is called as $PHP_SELF For example, let's say we
wanted to refresh a page every 4 seconds forever (not suggested :-)
then :
<meta HTTP-EQUIV="refresh" content=4;url="<?php echo $PHP_SELF; ?>">
For redirecting, you can use the PHP header() function like so :
header("Location: example.php");
That'll redirect to example.php , have a look at this related faqt for
more information on the topic of redirection :
http://www.faqts.com/knowledge_base/view.phtml/aid/4127/
Included are methods for doing it in html, javascript and PHP.