[Solved] PHP – header(‘location:profile.php’); not working [duplicate]


Here is your code:

echo "Invalid log in information.";
exit();
    header ('location:profile.php');

First when you execute an echo the server sends headers to the browser, so you can’t have that before a header call. But past any of that you have an exit(); before the header ('location:profile.php'); call. So that will never execute it. Just do this instead:

// echo "Invalid log in information.";
// exit();
header ('location:profile.php');

Commenting out the echo and exit just in case there is a valid reason for you to have those there. Perhaps for debugging? But if this is in production, those are not needed.

10

solved PHP – header(‘location:profile.php’); not working [duplicate]