The problem I'm having is that the line = header('location: loggedin.php'); is not bringing jumping to the loggedin page when I enter the correct Username and pword. Can someone see where my problem is?

$error = '';

//connect to db
$connectdb = mysql_connect("","","");

//select database
$selectdb = mysql_select_db("") or die ("Unable to select database");

    $username = $_POST['username-input'];
    $password = ($_POST['password-input']);

    //Select Username and Password in the database
    $login ="SELECT * FROM Jobseeker WHERE (Username = '$username') and (Password = '$password')";
    mysql_query($login) or die(mysql_error());

    //check if user input matches the database

    if ($num_rows == 1)
    $_SESSION['username'] = $_POST['username-input'];

    //Jump to loggedin page
      header('Location: loggedin.php');
    header('Location: userlogin.php');
    $error = 'Error: Incorrect username or password';
Member Avatar


make sure you haven't got any whitespace (outside the php tags) before the header. What's the point of the $error variable. It will be lost on redirect to userlogin.php.

echo "Numrows = $numrows";

And also change line 18 to:

$login = mysql_query("SELECT * FROM Jobseeker WHERE Username = '$username' and Password = '$password'") or die(mysql_error());

At the moment at line 22 the input for mysql_num_rows() is just a string, not a query result.

is it redirecting to any oter page or giving some error??
share your error also