Actually I think I found a solution, but I'm not sure why my solution is working. Here's the code for anyone else that's having this problem...
[ php ]
//If data is not clean, pass to general field error page
if (strlen($login_name) < 1){
header("Location: ../err/err_fielderror.php");
}
if (strlen($first_name) < 1){
header("Location: ../err/err_fielderror.php");
}
if (strlen($last_name) < 1){
header("Location: ../err/err_fielderror.php");
}
if (strlen($pass) < 1){
header("Location: ../err/err_fielderror.php");
}
//Insert record into database
.... some misc code .....
//Redirect user to home page
header("Location: home.php");
[ /php ]
The problem was, if the string was not supplied (length < 1 in this case), then the contents of the IF statement should be executed, in this case, redirecting the browser to the fielderror.php page.
In this case, even if one of the if loops triggered, the browser was not re-directed. However, what really stumped me is that the last re-direct at the bottom of the script was still working fine.
What I did to solve this, was to place "exit;" following each redirect. For example:
if (strlen($pass) < 1){
header("Location: ../err/err_fielderror.php");
exit;
}
Doing this made things work fine. For some reason, PHP seems to randomly ignore the redirect if exit; is not specified. I really don't know why this is, but it fixed my problem, so I'm happy.
Hopefully this can help anyone who has had the same problem.