I was just wracking my head trying to figure this one out, so I figured I'd share my experience with everyone.
Browser Tested On: Firefox 3.0.5 (Haven't tested to see if this happens in IE)
The Situation
I've got a page that a user needs to input information. This page has three fields that are required, two that are not. I fill out the form, yet leave out a required field (so I can test my validation code).
I'm sending the form data back to the same page as POST data and validating this data. If it fails validation, I'm sending the data back to the same page so I can display error messages and fill the form with previously entered data, yet I'm sending it back as GET data this time:
header("Location: index.php?var1=1&var2=2'); exit;
A SIDE NOTE: If you know how to send POST data outside of a form or CURL, that's part of a standard PHP install (CURL is not standard, so I can't rely on shared hosting clients to have CURL available), please let me know.
So now I'm back to the initial form, and the browser URL field (the bar that displays the current web address in your web browser) has this in it:
http://localhost/index.php?var1=1&var2=2
All of the error messages are displaying correctly and the form fields contain the data I entered before the form validation. No problems so far, good stuff.
Now I enter valid data, and the form once again sends the data back to it's self, this time as POST data again.
Everything validates, so the next page is processed and displayed. Once again, everything is working great, yahoo (no, that's not a plug, it's a shout of exhilaration).
The Problem
The browser URL field still displays the GET data:
http://localhost/index.php?var1=1&var2=2
After going back an forth between pages, and even moving a few pages forward in the sequence of forms I'm creating, the GET data still displays in the browser URL field.
I do an "echo var_dump($_GET)" and there's no data to be found. I do an "echo var_dump($_POST)" and everything that's supposed to be there is there.
So the data is transferring correctly, the only problem is that the GET data continues to display in the browser URL field. AAAHHHGGG!!!
If you've already figured out what's going on, kudo's to you. If not, please read on, this could save you a few dents in your forehead lol
The Solution
Do not enter blank "action" attributes in your forms (or leave them out altogether), even if you are sending the data back to the same page.
All of my forms had an empty 'action' attribute (action=""). Once I add the page name (action="index.php"), the browser would clear the browser URL field and display the "new" URL:
http://localhost/index.php
Wrap Up
That was a fun one. Thank goodness I wasn't at it for too long.
At first I thought that this was a browser issue. I had thought to start looking into javascript to clear the browser URL field manually, but that just seemed like a hack. I'm glad I decided to fool around a bit, because there's no way I'd release code with a hack like that, if it's even possible.
So now you know. If you're going to be using GET data at any time, don't forget to add an "action" to your forms (you should do it anyways to ensure forward compatibility, as you never know if/when you'll have to go back and start using GET data).