<?php //start php tag
//include connect.php page for database connection
Include('dbConnection.php');
//if submit is not blanked i.e. it is clicked.
// var_dump($_REQUEST);
session_start();
$errCount = 0;
$user = $_POST['usernameTbx'];
$pass = $_POST['passwordTbx'];
if(isset($_REQUEST['submit'])!='')
{
//VALIDATE USERNAME TEXTBOX
if($_REQUEST['usernameTbx']=='') {
$errCount += 1;
$_SESSION['error'] += array('usernameTbx' => "Username cannot be empty");
}
//VALIDATE PASSWORD TEXTBOX
if($_REQUEST['passwordTbx']=='') {
$errCount += 1;
$_SESSION['error'] += array('passwordTbx' => "Password cannot be empty");
}
if($errCount == 0) {
$sql=mysql_query("Select username, password FROM user_tbl WHERE username = $user AND password = $pass");
$row = mysql_fetch_array($sql);
if($row["username"]==$user && $row["password"]==$pass)
{
$_SESSION['sysMsg'] = array('$strSuccess' => "You have successfully logged in!" );
}
else
{
$_SESSION['sysMsg'] = array('$strFail' => "Incorrect Username or Password" );
}
}
header('Location: loginPage.php');
}
?>
This code always throws $strFail @_@. Can somebody tell me why? Thank you in advance.