Hi, I can't seem to work around the problem. If someone could please point me in the right direction for why the login.php page reloads when I enter the correct empid and password from the database. here is my code:
<?php
require_once("nocache.php");
if (isset($_POST['submit']))
{
$id = $_POST["empid"];
$pword = $_POST["password"];
if (empty($id) || empty($pword))
{
header("location: login.php");
}
else {
require_once("dbconn.php");
$sql = "SELECT empid, password, surname, departmentid, jobid
FROM employee, departments, jobs
WHERE empid = '$id' and password = '$pword' AND departments.departmentid=employee.departmentid AND jobs.jobid=employee.jobid";
echo $sql;
$rs = mysql_query($sql, $dbConn);
echo mysql_num_rows($rs)."<hr>";
exit;
if (mysql_num_rows($rs)> 0 )
{
session_start();
$_SESSION["who"] = $id;
$_SESSION["sname"] = mysql_result($rs,0,"surname");
$_SESSION["department"] = mysql_result($rs,0,"departmentid");
$_SESSION["jid"] = mysql_result($rs,0,"jobid");
header("location: choosereview.php");
}
else {
header("location: login.php");
}
}
}
?>