To make a long story short, pick one method and stick with it. If you store the failure message in the session data, then that is where you should look for it when you refresh the page. If you're passing it in the URL, then that is where you look for it when you refresh.
I'm also a wee bit confused as to what you're doing: as far as I can make out, if you find you have an error, you refresh the same page, passing the error message to it. Why? It seems a bit of a waste of time because you'll just end up back where you started.
May I suggest an approach like this:
session_start();
Set $failure_message='';
If we're here as the result of a form submission ($_POST['submit']!='',
if your submit button was named 'submit') then:
{
Check form fields for validity.
If any fields are invalid, set $failure_message accordingly (it's
nice to make all your checks, and present all the problems to the
user at once; instead of going "Fix this. Now fix this. Now fix
this..." on separate submissions you go "These need to be fixed..."
After checking for validity, look at the value of $failure_message.
If it's still '' after all that checking ,
{
either store their details in your database now (if that's what
you do), or store them in $_SESSION variables.
Then, header("Location:...") to the form acceptance page. (If
you sessioned the form data then session_start() will later
retrieve it and you can do with it what you want then.)
}
else
{ // $failure_message was [i]not[/i] '', so there was an error.
}
}
Display the form. If $failure_message!='', now is a good time to display
it somewhere approprioate. Don't forget to use the contents of $_POST
and repopulate the form fields with the data the user has already
entered.
Note that if you store your form data wherever you're going to store it
(I assume a database), then you have no need to carry either it or any
failure message to any other page.