just as i know that is the login form and the register form is need to have the error handling and i'm using a php for the main code language, there is such an errors handling if i put into an php language its kind of silly, i mean the design is more or less than nothing
i want to put an error handling like "Your Username and Password Combination is Incorrect", 'We Can\'t Find That Username', 'You Need To Enter a Username And a Password',
on the footer page it will pop up message if the user is do something wrong with the form
this is my code html:
<div id="header">
<div id="header-content">
<div id="logo"> <a href="index.php" style="text-decoration:none;">
logo</a>
</div>
<div id="searchbox">
<input type="text" placeholder="Search" size="50" class="searchbox">
</div>
PHP
if(empty($_POST) === false){
$username = $_POST['input-username'];
$password = $_POST['input-password'];
if(empty($username) === true || empty($password) ===true){
$errors[] = 'You Need To Enter a Username And a Password';
}
else if(user_exists($username) === false){
$errors[] = 'We Can\'t Find That Username';
}
else{
$login = login($username, $password);
if($login === false){
$errors[] = 'Your Username and Password Combination is Incorrect';
}
else{
$_SESSION['user_id'] = $login;
header('Location: home.php');
}
}
print_r($errors);
}
and back to form in html
<div id="users">
<form method="post" action="" name="signin-form">
<table border="1">
<tr>
<td>Username</td>
<td>
<input type="text" name="input-username" id="input-username">
</td>
<td>Password</td>
<td>
<input type="password" name="input-password" id="input-password">
</td>
<td>
<input type="submit" name="sign-in" id="sign-in" value="Log in">
</td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" name="remember-me">
<label id="information">Keep Me Eating Picture</label>
</td>
<td colspan="2"> <a href="#" id="forgotpass">Forgotten My Username or Password</a>
</td>
</tr>
</table>
</form>
<button id="sign-up">Sign Up</button>
</div>
</div>
</div>
there is some core items that i can't show in here such as connect to database and function page(which is the page full of function that i need)
im showing this code for information that i'm using array errors handling but i want to show the error message on footer side somebody please help me btw sorry for my english, and thx for your concern