Jump to content

page has expired warning


jwhite68

Recommended Posts

I have seen several posts on this subject on the net, but no clear solution.

 

I have a php page that presents a summary of 'objects', after which the user selects an object to see the 'detail' page of an object.  On this detail page there is a 'back to previous' hyperlink, which simply goes back 1 page in the history.

 

However, in this case, it always comes up with the Warning: page has expired first.

 

Since what I am trying to do is very standard and normal in PHP - is there anyway at all (without resorting to GET) to prevent this annoying behaviour?

Link to comment
https://forums.phpfreaks.com/topic/57413-page-has-expired-warning/
Share on other sites

i thought I had an idea for you....until you said you'd rather avoid get

 

in a system I made there was a simple search and in order to go back i provided a button which resubmitted the original search string sotred in a variable via GET and that way essentially performed the search again.

 

Inefficient but it worked and it's alot neater than the expiry warnings

Yes, I have been trying a variation on that theme, using session variables instead - but still havent worked out the logic yet for clearing the session variables down.

 

I was storing the actual SQL query in a session variable, to resubmit in the relevant PHP script.

 

Principally it works. But since someone can submit another search query, the value of this session variable is still set, so it continues to use it everytime.

Well post the code and we can help with the logic.

 

POST data always does a "postback" which is why you see that error. No matter what if you send POST data to the page and a back button is pushed that will be the error you get.

 

There are a few ways to work around it, 1 simply use AJAX. Use ajax to submit the search query behind the scenes and either store the data in session and redirect the page or just return the data and parse it on the page itself.

 

The other way is you POST the data with the submit to the processing page, in the processing it querys and than stores it in session and redirects you to the "display" page, this will clear the post data from cache and the back button should take them back to the initial page.

Thanks, but I managed to sort it out.  Basically, I did use session variables - and instead of storing the SQL query - on the page I may want to come back to, I store the $_REQUEST parameters in a session variable, together with the full URL.  Then on my back to previous link, I use the value of this session variable.  Appears to be working well.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.