faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

397 of 643 people (62%) answered Yes
Recently 7 of 10 people (70%) answered Yes


1. how to redirect from php page to another php page? 2. how to refresh a page?

Nov 27th, 2008 04:59
healthy man, 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 :
Included are methods for doing it in html, javascript and PHP.