I have the following code designed to begin a session and store username/password data, and if nothing is submitted, or no session data stored, redirect to a fail page.
Here are a few other things, which may or may not help you, by the way :
session_start the first thing you are doing in your page ? There must be nothing output before