I have two page login.php and user.php(where the message = Wrong Combination which i one to echo his) am trying to display a message in login.php which is from user.php that is base on wrong combination of email and password please how can I display the message in my login.php below is my code
The user.php page below
class Users {
function login($find='') {
if(($rows["email"] == $email)&&($rows["password"] == $password)){
$_SESSION['email'] = $email;
$_SESSION['password'] = $password;
if (isset($_POST['remember'])){
setcookie("cookname", $_SESSION['email'], time()+60*60*24*100, "/");
setcookie("cookpass", $_SESSION['password'], time()+60*60*24*100, "/");
}
$_SESSION['user_id'] = $user_id;
return true;
}
else {
$message = 'Wrong Combination';
return false;
}
}
}
The login.php page below
<?php
include_once("user.php");
if (isset($_POST['submit']))
{
$find = $user->login($_POST);
if ($find)
{
header ("location: panel.php");
exit;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
<form name="form1" method="post" action="">
<!-- I want to echo it here I echo the variable message but did not work -->
<?php echo "$message";?>
input id="email" />
<input id="password" />
</form>
</body>
</html>