RE: [PHP-WIN] Re: Go back function...

From: Date: Mon, 28 Apr 2003 23:05:50 +0000
Subject: RE: [PHP-WIN] Re: Go back function...
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-19701@lists.php.net to get a copy of this message
Thanks for the great response. I hadnt worked out why it was doing the problem and I expect what you put below is indeed why its does this. There are a couple problems, one of which is the error on 'back' but even if I remove that error the loading of the frames fills the history with entries. When I click the down arrow and list all thats in the history its full of these entries, so even if I fix the error the user would have to click 15+ times just to get back to their original page. Unfortunetly I dont have a lot of control over the frames, thus the idea of messing with the history. There is a javascript function that lets you load a page and not leave an entry in the history, what I need to do is go back through all the code that comes with the program and use that function instead of all the things they are using now. A daunting task however, and for now removing the back button works :) Thanks again, Ken -----Original Message----- From: Warren Vail [mailto:warren@vailtech.net] Sent: Monday, April 28, 2003 4:47 PM To: Ken Sanderson; php-windows@lists.php.net Subject: RE: [PHP-WIN] Re: Go back function... Actually, the history stack is kept on the browser machine (by the browser), so any language that could trigger a reference to it, would have to be executable on the browser (which PHP ain't), and that leaves you with a couple of choices, but the most widely used is JavaScript. Perhaps you should consider trying to solve the problem that caused you to disable the back button in the first place. I am guessing here, but have encountered and worked around this problem. See this is your problem, you are on a form that uses the POST method, you click submit, which presents a second form, which also uses POST, and after clicking submit, you go to a third form, perhaps showing an error, you press the back button on the browser and you get a nasty message from your browser that the 2nd page cannot be restored, or some such. The problem, the browser only saves the URL (and any get parameters that are attached to it), but does not retain the data sent with the POST, so pressing the browser back button takes the browser to a page that it has not retained enough information to present as it was when you left it, or so it thinks, (hence the message). Both Netscape and IE behave this way. The solution is to enter each of your form pages using a GET (only passing data in the URL), and have all forms using POST invoke a PHP module that displays nothing, does some processing (such as saving POSTed data as session variables), and before outputting anything, issue a redirect to the next displayable form (a GET)(see the header function). This next display form can then find the values from the preceding form in session variables, and it was entered via a GET which means the browser should be able to reconstruct it. Another benefit of this approach is that you can use it to separate your "presentation layer" from your "processing/application layer", to assist in the maintainability of your code. If this was not your problem, please accept my apologies, and toss this message where it will never see the light of day. hope this helps, Warren Vail warren@vailtech.net -----Original Message----- From: Ken Sanderson [mailto:ken@rockies.ca] Sent: Monday, April 28, 2003 12:07 PM To: php-windows@lists.php.net Subject: RE: [PHP-WIN] Re: Go back function... Is there a way to set the history with PHP? I know you cant with javascript, but taking a stab that maybe PHP can do it? Basically I have a project that opens a pile of frames after you get to the site, hitting the back button often breaks things. We get around this by removing the buttons and creating our own back button, but it would be nice to not have to do that by setting a URL to the history object. Ken -----Original Message----- From: Joshua Groboski [mailto:joshua.groboski@savvis.net] Sent: Monday, April 28, 2003 12:31 PM To: php-windows@lists.php.net; Afan Pasalic Subject: [PHP-WIN] Re: Go back function... Javascript: history.go(-1); Josh Afan Pasalic wrote: > Hi, > I know there is sucha function, to send you back to last visited page > but can't find it. Help! > > Afan > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.windows (#19701) next »