Mateo Mateo - 5 months ago 19
PHP Question

How to display something in HTML when #error is added at end of URL

This is my situation, I have a login page and in the functions folder there is the php for that, say the page is example.com/login.php, upon login error it redirects to example.com/login.php#error

Essentially I'm trying to figure out how to add code that only shows when you are on the #error page.

Answer

redirect with url like this:

example.com/login.php?error=here_Message

then, use this code for get the message:

<?php
if(isset($_GET['error'])){
    echo $_GET['error'];
      }
?>
Comments