Jump to content

header log in validation errors


ben_johnson1991

Recommended Posts

Hey, I have a homepage which include the main header, the main header include the log in fields for the user, and the form submits to a scripts called login.php which re-directs to homepage after it has ran.

This all works fine :).

 

my problem now is when I run the validation ( check to see if all fields are filled or match etc)...

I have no Idea how I'm supposed to print them back onto the header in he homepage afterwards as the errors would have been created just on a script page (login.php) and won't carry when it is re-directed back to the homepage (regardles of a sucsessful or unsucsessful login)

 

How can I set error variables in the login.php and run them on the header inside of the homepages when a user signs in as at the moment there is no error messages appearing and it is pretty vital to have some form of feedback.

 

I thought about just using SESSIONs but i wouldn't know how to unset the errors as soon as they have been printed or else the errors will constantly be there when the user isn't logged in until they completely close their browser.

 

If someone could help i would be very greatful as this really puzzles me!

 

Many thanks

Ben.

Link to comment
https://forums.phpfreaks.com/topic/186578-header-log-in-validation-errors/
Share on other sites

I thought about just using SESSIONs but i wouldn't know how to unset the errors as soon as they have been printed or else the errors will constantly be there when the user isn't logged in until they completely close their browser.

 

if (isset($_SESSION['errmsg'])) {
  unset($_SESSION['errmsg']);
  echo "There was an error";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.