lundi 26 octobre 2020

Displaying a Username or Password Feedback Message using PHP

I'm working on this particular assignment that requires that I have messages show up when an invalid username or password is entered. I have it set up so that when something happens, it redirects the page back to the Index.php page, but with the added ?message=Bad_Username or ?message=Bad_Password. I also have an if statement set up so that I can get the message to print below the username or password when certain parameters are hit. I am just not certain what the If statement condition needs to be for it to work.

Here's the code.

if (($_GET['username'])){
          echo "<p class='help is-danger'>This username is invalid</p>";
          if(header("location: index.php?message=Bad_Username")){
             echo "<p class='help is-danger'>This username is invalid</p>";
          }
        } 
        ?>

Aucun commentaire:

Enregistrer un commentaire