View Full Version : redirecting a page when wrong user and pass
I get the error: headers already sent
// Register $myusername, $mypassword and redirect to file "login_success.php"
echo "Wrong Username or Password";
05-15-2008, 10:18 AM
//echo "Wrong Username or Password";
You can't echo/output something before header()
i swapped them around, still doesn't work
05-15-2008, 02:40 PM
It never will mate, as soon as you send a header redirection it will force the page to the new location - you will never get the output from the echo. Instead, redirect them to a page that includes the error message, or use the $_SESSION (from your last post) or $_GET, to pass an error code back to the login to display the results. Something like:
Then back in index.php
// some stuffs
echo 'Invalid username specified';
echo 'Invalid password specified';
// login stuff.
Or whatever you want to do with the feedback.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.