I'm working on a login system, and I was wondering how to send errors back to the form?
I will personally use AJAX in my project so it won't really a problem but I'm curious to know how it's possible with pure php.
This is the form... On login.php
or some other page:
<form method="post" action="proccessLogin.php">
<label for="username">Username: </label>
<input type="text" name="username" />
<label for="password">Password: </label>
<input type="password" name="password" />
<input type="submit" name="submit" value="Go!" />
</form>
processLogin.php
:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if(password is incorrect){
// send error or add to an error array and then send it.
}
etc...
?>
This is just a piece of code I just wrote so it's obviously not complete.
Thank you!