TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   back button (http://www.talkphp.com/absolute-beginners/1953-back-button.html)

meshi 01-14-2008 04:19 PM

back button
 
hi all can u help me how to get rid of this error:

i try to put a back button on every page and this is my code:

PHP Code:

<input type="button" value="Back" onclick="history.back()" class="dtext"

its working but sometimes ill get this "Warning: Page has Expired".How to get rid of this warning?:-/

Alan @ CIT 01-14-2008 08:46 PM

I suspect these expired pages are forms that you have submitted to your site? If so, this is a common problem with POST unfortunately.

Take a look at some of the google links below for solutions.

php post refresh - Google Search

Alan.

Wildhoney 01-15-2008 12:42 AM

In a nutshell, the best way to go about this is to save all the data into hidden elements on the error page, and then have your back button post all that form data back via POST, and repopulate the text fields with that data. Obviously you'll want to invent a scheme where it is all automated, and you just put something like the following as the value for your form text field elements:

php Code:
echo $this->getPost('username');

So it's all automated up to a point, unless of course you want to use Javascript to make it 100% automatic, though this isn't recommended.

meshi 01-15-2008 11:44 AM

i still dont understand...sory..could u please give me an example code...(procedural please i am not good in oop)

Aaron 01-15-2008 12:47 PM

as well as the back button, try implementing the following:

Code:

<input type='hidden' method='POST' name='PostValueFromLastPage'>
And make sure that everything you posted to the page before the page you are on is carried over. This might cause some slowdown, but it is all I can think of. using GET would work if the code didn't need to be secure.

webtuto 01-15-2008 03:14 PM

PHP Code:

<input type="button" value="Back" onclick="history.go(-1)" class="dtext"

try this

meshi 01-16-2008 09:49 AM

Quote:

<input type="button" value="Back" onclick="history.go(-1)" class="dtext">
i also tried that one webtuto but sometimes it also has a page expired


All times are GMT. The time now is 10:34 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0