<input type="text" name="StaffID"/>
<input type="password" name="Password"/>
<input type ="submit" name ="submit" value="submit"/>
$sid = $_POST["staffid"];
$pass = $_POST["password"];
//connection to database has been opened already
$query = "SELECT * FROM staff";
$query.= "WHERE staffid = '$sid' AND password = '$pass'";
$result = mysql_query($query);
$num = mysql_num_rows($result);
if($num > 0) {
session_start();
$_SESSION["who"] = $sid;
//$_SESSION["level"] = mysql_result($rs,0,"level");
header("location: selectview.php");
}
else {
header("location: login.php");
}
looking at line 2, "$query.= "WHERE staffid = '$sid' AND password = '$pass'";", the error i'm having is that if i was to replace $sid and $pass with something from the database the query works fine and returns a value, but then i put them with $sid and $pass (which are linked to $_POST and the values of them is determined by whats entered into a text box in the form it just dies and stops finding anything. anything you search for doesn't find anything and returns a 0. i've posted as much useful code that can help with this problem but if you need more let me know, thanks in advance to any answers.