标题位置不起作用 - 但绝对被传递

Annoyingly my log in check script is not redirecting where I tell it to. I know it hits the if statements correctly because I put in echos to check it did. It is blatantly skipping to header as during the first circumstance it echos "- blanks" as it should then also "Did it even get this far?"

So on that basis I know it hits the header - its just plain ignoring it and I can not for the life of me fathom why.

Im sure its simple and I'm missing something ridiculously obvious but I just cant see it. Any suggestions?

// makes sure they filled it in 
if($_POST['frmLogin-username'] == "" || $_POST['frmLogin-password'] == ""){
    echo " - blanks";

    header('Location: ?page=landing&action=login&message=1');
    echo "Did it even get this far?";
    die;
}
else{
    // checks it against the database
    $query = mysql_query("SELECT * FROM shops WHERE shopUsername = '".$_POST['frmLogin-username']."'");

    //Gives error if user dosen't exist
    $count = mysql_num_rows($query);

    if ($count == "0"){
        echo " - no user";
        header('Location: ?page=landing&action=login&message=2');
        die;
    }
    else{

        while($row = mysql_fetch_array( $query )){

            //gives error if the password is wrong

            if ($_POST['frmLogin-password'] != $row['shopPassword']){
                echo " - wrong pass";
                header('Location: ?page=landing&action=login&message=3');
                die;
            }

            else{

                // if login is ok then we add a cookie

                $hour = time() + 3600;

                setcookie(shopusername, $_POST['frmLogin-username'], $hour);
                setcookie(shopid, $row['shopId'], $hour);

                //then redirect them to the shop panel
                header("Location: ?page=shop");
                die;
            }
        }
    }
}

EDIT: The issue was to do with the way I load all my pages within index.php by calling includes which I am now investigating I have moves this process page to its own php file and it now works fine

The issue was to do with the way I load all my pages within index.php by calling includes which I am now investigating I have moved this process page to its own php file and it now works fine

First of all: you can not send headers after having output anything using echo like Sam said in his comment.

Secondly, to send a redirect, the URL after the Location: must be absolute, like http://localhost/page/to/redirect/to.php.

EDIT
Corbin actually beat me to my answer for about 10 seconds ;-)

You can use window.location, just echo it within PHP.