Page 1 of 1

header question

Posted: Tue Nov 15, 2005 6:14 pm
by shiznatix
what is the header that i put in so when i hit back to a submitted post page it does not ask somtin like "the page you are going to has POST data, would you like to resubmit that data?" kinda deal.

Posted: Tue Nov 15, 2005 7:05 pm
by trukfixer
You cant, as far as I know - it's stored in your browser history .

The trick to that is, use the post-process-redirect method .. (It's got a name, cant think of it right now) basically you start on page a, post to page b, page b takes your post data and processes it (or assign to session, whatever) and with no further ado, redirects you to page c .. there's a way to do it so that clicking "back" button wont resubmit post data..

I havent really studied this issue in depth, however I *did* touch on an idea that occurred to me that I wrote out in my blog... Within the next couple weeks, I'll be wrestling with the issue myself, so any better solutions to the "back and resubmit" problem other than what I have already figured out would be nice.. :)

Posted: Tue Nov 15, 2005 7:08 pm
by shiznatix
no its possible, i did it before i just dont have access to that code anymore. i know its a certain header i just cant remember what it was.

Posted: Tue Nov 15, 2005 7:20 pm
by kevinoneill
Same Problem, bump for the answer. :?:

Posted: Tue Nov 15, 2005 7:24 pm
by Roja
kevinoneill wrote:Same Problem, bump for the answer. :?:
Do not bump within 24 hours.

Posted: Wed Nov 16, 2005 7:50 am
by twigletmac
If you use header() to redirect after processing of the page (basically like trukfixer said) then you clear the POST data and you won't get the message (and users won't know).

Mac

Posted: Wed Nov 16, 2005 8:15 am
by shiznatix
no no i want the post data to still be there, i just dont want it to ask the user. its for a search thing, it searches and finds the results (yay!) then you can view the profile of the person then if you hit back, to go back to your search results it says "in soviet russia, post data posts you" or some other equally commy message. i dont want that message, i just want it to go back and resubmit the post data. i know this is possible its just a specific header.

Posted: Wed Nov 16, 2005 8:27 am
by twigletmac
Hmm, if you can't find the header (or it turns out to be browser specific) you could always copy the $_POST array to the $_SESSION array and use header().

Mac

Posted: Wed Nov 16, 2005 2:47 pm
by shiznatix
hummmm maybe it is not possible. i know i used

Code: Select all

header('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
in the past and it worked but now it seams to not be working. this is very sad indeed

Posted: Wed Nov 16, 2005 3:27 pm
by Buddha443556
How about a 303 redirect? It's in the PHP Manual somewhere ...

Code: Select all

header('Status: 303 See Other');
header('HTTP/1.0 303 See Other');
header('Location: http://' . $_SERVER['SERVER_NAME']
. $_SERVER['PHP_SELF'];
exit();
Anyway by using a 303 redirect the POST page isn't cached and therefore no prompting of the user about POST data.

http://ppewww.ph.gla.ac.uk/~flavell/www ... irect.html
shiznatix wrote:hummmm maybe it is not possible. i know i used

Code: Select all

header('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
in the past and it worked but now it seams to not be working. this is very sad indeed
Switch the browser you use?