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

Cathy

Junior Member
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?
 
EDIT: This is the correct way apparently

Code:
header("location: http://www.domain.com/protected.php");
 
use following :

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

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