I am trying to redirect user to pacific page after giving the right username, password and classgroupid but I am not sure how it is done.
Code: Select all
$query = "SELECT * FROM studentinfo WHERE username = :username AND password = :password AND classgroupid= :classgroupid";
$statement = $connect->prepare($query);
$statement->execute(
array(
'username' => $_POST["username"],
'password' => $_POST["password"],
'classgroupid' => $_POST["classgroupid"]
)
);
$count = $statement->rowCount();
if($count > 0)
{
$_SESSION["username"] = $_POST["username"];
header("location: ????.php");
}
else
{
$message = '<label>Wrong Data</label>';
}
EDIT: I forgot to mention that the record "classgroupid" is also a field in the form itself, so can we take the value from the form if not possible from MySQL database? How it is done?
Thanks,