• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to redirect users to another page midway through a PHP script?


Cathy

Junior Member
#1
Just wondering if anyone would be able to help me come up with a solution to a problem I have..

Basically, I have created a simple login system in PHP and atm, when the user logs in with a valid username and password, the script echos a link to the password protected page. Is there something I could add to the script so that when someone logs in successfully, they are automatically taken to the protected page?
 

gwebhostuk

Junior Member
#3
use following :

<?php
header("Location:destination_page.php");
exit;
?>

Do not forget to put <?php ob_start(); ?> at the top of your file