Hey,
My login form somehow isnt working and i cant find out why:S
I tried shifting around the variables but it still wont work.The code is:
<?php
$id=$_POST["empid"];
$pass=$_POST["password"];
if(empty($id)|| empty($pass))
{
header("location:login.html");
}
else
{
require_once("dbconn.php");
$sql = "SELECT empid,surname,firstname,jobid,jobtitle FROM employee,jobs WHERE empid='$id' AND password='$pass' AND jobs.jobid=employee.jobid";
$rs = mysql_query($sql, $dbConn);
if (mysql_num_rows($rs)> 0 )
{
session_start();
$_SESSION["who"] = $id;
$_SESSION["sname"] = mysql_result($rs,0,"surname");
$_SESSION["firstname"] = mysql_result($rs,0,"firstname");
$_SESSION["jid"] = mysql_result($rs,0,"jobid");
$_SESSION["jtitle"] = mysql_result($rs,0,"jobtitle");
header("location: choosereview.php");
}
else
{
header("location: employee.php");
}
}
?>
Everytime i try logining in, when i leave it empty it works,but when i type the right user name and password,instead of taking me to the choosereview.php it takes me to employee.php.It does the same even when im wrong.I mean it works fine for wrong,but it wont work fine when its right.I also needed to know if this was the right way to access data from two tables?I have doubts that, that might be the problem.