I currently have this login page.
<form action='http://localhost:8080/iSchedj/API/api.php' method='post'>
<fieldset>
<p>
<label for='username'>Username</label>
<input type='text' id='username' name='username' value='' maxlength='20' />
</p>
<p>
<label for='password'>Password</label>
<input type='password' id='password' name='password' value='' maxlength='40' />
</p>
<p>
<input type='hidden' name='form_token' value='<?php echo $form_token; ?>' />
<input type='submit' name='login' id='login' value='Login' />
</p>
</fieldset>
</form>
On submit, I have a function on the server-side where I analyze the data and check if there are any issues.
Problem is, I would like to send a response back to the client and re render the login page if any issues occurred with a response saying 'Error on login'.
I am having an issue with the response part.
On the server side, I just run this when an error is found in the form
header( 'Location: http://localhost:8080/iSchedj/index.php');
echo 'Incorrect Length for Password';
which redirects the client to the login page. But how do I send the error message to the page as well? The echo message is no where to be found.
$_GETand redirect the user with a GET-variable (for instance,header( 'Location: http://localhost:8080/iSchedj/index.php?error_code=1');. There might be other, better methods though. - Max