OK, now I understand what you want to do: you want to prevent page from refreshing, right? So that the data doesn't resend on refresh, right? I think this is a classic problem that has haunted Web-programmers since the beginning of the ace age. Back then of course they didn't have computers, so preventing a user from refreshing was easy; they just clubbed them to death. Now these days with human rights issues you can't club the user to death.
ANYhow... If I have understood you problem correctly the best solution would be a server side one. You could probably disable the "F5" button with JavaScript but that would be the "easy way" out. And the easy way out usually leads to the big head ache later.
I haven't yet come to this problem (i.e. "double posting) with my project yet, so I can't help you further than giving you the "what-you-do-not-want-to-hear-advice": Goggle.
However, I have one little "extra" thing. This is a extract from a forum I stumbled a long time ago. I saved the text because I thought it summarized the form problem quite nice. Unfortunately I do not remember which forum I got this from -- if anyone knows give me the URI so I can give credit where credit is due to come back to me, more to me.
YOU have to control this.
You either deal with the fact that the data MAY be resubmitted.
Or
When the data is submitted you direct the client to a new page which redraws the order data (like Roonaan suggested).
I would recommend doing both.
When you generate the form, place in the form a hidden value containing the datetime of the page's creation. Place the same value in the session and add another flag to the session saying that the form is active ...
$dt_form_created = microtime(True);
$_SESSION['Forms'][$dt_form_created ]['Active'] => True;
When the user POSTs the form, compare the POST'ed datetime against the session. If they exist, then check the sessions 'Active' staus. If the form is active, then you can submit the data to the DB and then set the status to False. If not, then the data has already been submitted and you need to draw a new form or tell them that the data has already been submitted.
Source:unknown.