Back button not working after PHP submission?
am 10.09.2004 13:10:01 von Aaron Whiffin
If you go to www.classiccarsforsale.co.uk and enter "ferrari" for example in
the search box, you get a list of cars generated by PHP/MySQL.
If you then click on a car you see its advert
If you then click the "back" button in IE you get a "Warning, this page has
expired" message.
Other sites seem to display the last page generated rather than this
message.
How do I do this?
Many thanks
Re: Back button not working after PHP submission?
am 12.09.2004 19:48:27 von Wes Spikes
Sorry for the late response but I think I know this one :-). LOL. I've
encountered this myself. You need to use GET instead of POST to send data.
-Wes
"Aaron Whiffin" wrote in message
news:dYf0d.54$KL1.41@newsfe3-win.ntli.net...
> If you go to www.classiccarsforsale.co.uk and enter "ferrari" for example
in
> the search box, you get a list of cars generated by PHP/MySQL.
>
> If you then click on a car you see its advert
>
> If you then click the "back" button in IE you get a "Warning, this page
has
> expired" message.
>
> Other sites seem to display the last page generated rather than this
> message.
>
> How do I do this?
>
> Many thanks
>
>
Re: Back button
am 14.09.2007 15:57:09 von Tyno Gendo
Albert Ahtenberg wrote:
> Hello,
>
> I have two questions.
>
> 1. When the user presses the back button and returns to a form he filled
> the form is reseted. How do I leave there the values he inserted?
I always capture the values into a session and when the form is created
I echo the session values into the value="" section, or whatever is
needed, different in the case of checkboxes etc., have to mark as
selected="selected" etc.
You could use normal cookies too if you don't want to start a server
session.
> 2. When the user comes back to a page where he had a submitted POST data
> the browser keeps telling that the data has expired and asks if repost. How
> to avoid that? I tried registering all POST and GET vars as SESSION vars but
> it also has its disadvantages...
I usually use a header redirect back to forms when data is invalid or
when a succesful submission is made, I use a session var 'messages' to
hold any messages to print at the top of the form
eg.
$_SESSION['messages'] = 'Your submission was invalid';
exit(header("Location: {$_SERVER['PHP_SELF'}"));