Show login error message with PHP

-1

I'm doing a login system and I want the user to try to log in and miss the login, so I get a <div> saying that the information is wrong, but if I do this I give echo "<div> Informações erradas </div>" , so the user give a refresh on the page, you will be asked to resubmit form. How do I avoid this and keep my div? I've already tried using header("Location: login.php") , but if I do this my <div> Informações erradas </div> will be deleted from the page. How do I keep it?

    
asked by anonymous 05.01.2019 / 01:13

1 answer

0

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

and get the data through GET

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

    
05.01.2019 / 01:21