Lets improve your code a bit to narrow down the problem
Code:
<?php include("admin-dbcon.php"); //Check to see if the username and password is in database $username = $_POST['username']; echo $username; #disable for header to work $password = $_POST['password']; echo $password; #disable for header to work $sql = "select * from admin_login where username = '$username' and password = '$password'"; echo $sql; #disable for header to work if($validate = mysql_query($sql)) { $isvalid = mysql_num_rows($validate); echo $isvalid; //if valid login send on, if not send to error page if ($isvalid) { $_SESSION['username'] = $_POST[username]; while ($row=mysql_fetch_array($validate)) { $_SESSION['userid']=$row["ID"]; } print_r($_SESSION);#disable for header to work //If everything is OK up to here un-comment header #header("Location: admintasks.php"); } else { echo 'invalid login'; #header("Location: login-error.php"); } }else echo 'empty recordset'; ?>
Comment