header question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

header question

Post 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.
User avatar
trukfixer
Forum Contributor
Posts: 174
Joined: Fri May 21, 2004 3:14 pm
Location: Miami, Florida, USA

Post 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.. :)
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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.
kevinoneill
Forum Newbie
Posts: 6
Joined: Tue Nov 15, 2005 7:19 pm

Post by kevinoneill »

Same Problem, bump for the answer. :?:
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

kevinoneill wrote:Same Problem, bump for the answer. :?:
Do not bump within 24 hours.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post 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?
Post Reply