thanks got it fixed: if (!empty($_POST['UserName']) && !empty($_POST['Password'])) { $UserName = $_POST['UserName']; $Password = $_POST['Password']; } *<---was missing a curly bracket..oi syntax* $msg = ''; if (!empty($UserName)) { $sql = "SELECT `AdminID`,`UserName` FROM `admin` WHERE `UserName`='$UserName' and `Password`='$Password'"; $result = mysql_query ($sql); $row = mysql_fetch_object ($result); If (mysql_num_rows($result) > 0) { $_SESSION['AdminLogin'] = true; $_SESSION['user'] = $UserName; $_SESSION['AdminID'] = $row->AdminID; header ('Location: Main.php'); exit;