Why does the execution continue after redirection using header()?
$flag=1;
if($flag==1)
header("Location:page1.php");
header("Location:page2.php");
When I use this code the browser redirects to page2.php.
Why does this happen?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to put an
exit;after the header call; PHP does not automatically stop executing code after the client stops loading the page.