Show error message when logging in with PHP

Asked

Viewed 1,218 times

-1

I am making a login system and I want the user to try to log in and make the login wrong, appear a <div>saying that the information is wrong, however, if I do this by giving a echo "<div> Informações erradas </div>", As soon as the user refreshes the page, they will be asked to resubmit the form. How do I avoid this and keep my div? I’ve tried using the header("Location: login.php"), however, if I so mine <div> Informações erradas </div> will be deleted from the page. How I keep it?

  • Speak up, Douglas! Help colleagues who will help you by posting the full code (only related parts). edit your question to do this.

1 answer

0


You can use the header("Location: login.php?error=dadoserrado") inside the php check file and when you are on the page where the user logs in, you can do it:

and take the data through GET

if (isset($_GET['error'])) { if ($_GET['error'] == "data sent") { echo "Alert('Data is incorrect!');"; }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.