Forum Moderators: coopster

Message Too Old, No Replies

Alternative to hit the "Back Button"

         

joaquin112

4:21 am on Mar 27, 2006 (gmt 0)

10+ Year Member



I have a client who asked for a page where people order products for his site. This is then sent to the shopping cart. I am currently displaying an error message, "Please click the back button to try again", but my client does not want this. Is there a simple way with PHP to redirect users to the previous page, or should I code the custom error handling by hand?

coopster

12:45 pm on Mar 27, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



There are a number of options, really. You could code the previous page link into this page they are on, you could use a redirect to push them back to that page, or you could process messages and include the html source from the previous page again.

joaquin112

8:22 pm on Mar 27, 2006 (gmt 0)

10+ Year Member



The problem is that all the pages are actually in a single script. Is there any way to make PHP display a button which, on click, returns the user to the previous page and posts exactly the same $_POST? I am not sure if I am explaining this properly. Thanks anyway!

coopster

8:25 pm on Mar 27, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If the button was in a form you could pass back all posted variables in either hidden form fields or in a session. Then, when you get back to the page you were on you would read these values in if they existed and print them in the "value" attribute of the <input> element for that page.