I’m working on a login system and I want, I case the user entered wrong username & password to return him to the login page with an error (“Wrong username or password” for example)
At the moment I’m using 2 files:
file number 1 – html – the login form that post the username & password to file number 2
file number 2 – php – checks the username & password, in case they match, redirect to the next page
else, displays an error message in page number 2
I want it to display the error message in page number 1.
I’ll appreciate your help
Guy Dor
You can collect the error message and set it as a session variable. This type of session message is called “flash message”.
Check out a similar question Help a Beginner with a PHP based Login System
The example on that question contains a way to implement session based flash message.