Monday, December 7, 2009

Redirect a page using PHP

Redirect a page using PHP

Redirect page is used to divert one page to another page. Usually this is used to switch to another page when there are improvements to the site, or when doing authentication, charging or running through a database query using php or server side scripting others.

There are 2 types of redirect functionality to this page:

The first was the addition of meta tags that are used in the html head tag.

And the second is the header functions provided by php.

This method can be used to redirect the user to login first before you enter the forum page or other pages that require login authentication. With a note should be added one or two global variables Request, which works to save the page when the authentication is completed. For this PHP tutorial, I am just explaining the point of the redirect itself.

For the first, I used to use to redirect the user when finished filling guestbook.

On the page that displays the results from the guestbook which has been filled, you simply need to add the following script:

<meta http-equiv="refresh" content="5;url=">

A little explanation about the script, number 5 on the script shows the time required before the script redirecting your page (in seconds).

For the second, the php header function. The author used to use it for authentication. Usually combined with a session variable. Please note that the header function is used before the html tag.
For example:


The script above will redirect you to
For the next session the author will provide a more complex example.

Related Posts by Categories


Post a Comment

Maybe this is what you looking for


Subscribe Now


IT Skill is not enough... Copyright © 2009 Designed by Bie Blogger Template