I have a register.php, login.php, and main.php. How do i redirect user after after registration submit to login page and then login page submit to main page.
header("Location: /login.php");
exit;
See the exit
. Don't ever forget to do this. If you have sensitive data after this, it will be visible to anyone that doesn't follow location headers (such as some bots).
To stop you from forgetting, you could build a wrapper type function
function redirect($url) {
header('Location: ' . $url);
exit;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With