zgkhoo Posted November 4, 2007 Share Posted November 4, 2007 when i click the BACK button in moziila or IE to browse my site that i write, then always pop out this error msg.. how to modify my code to make it disappear? thanks.. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 4, 2007 Share Posted November 4, 2007 You can't, this is proper behavior built into the browser. When you try to go BACK to a page that had posted data, that posted data is not sent, so the popup is giving you the choice of resending the data. There may be a Javascript workaround, you might post this question on the JS board. PhREEEk Quote Link to comment Share on other sites More sharing options...
bwochinski Posted November 4, 2007 Share Posted November 4, 2007 The only workaround I can think of would be to not use POST. Not necessarily an option of course. Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted November 4, 2007 Author Share Posted November 4, 2007 You can't, this is proper behavior built into the browser. When you try to go BACK to a page that had posted data, that posted data is not sent, so the popup is giving you the choice of resending the data. There may be a Javascript workaround, you might post this question on the JS board. PhREEEk how about if i wanna retain those value when i click the back button? Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 5, 2007 Share Posted November 5, 2007 how about if i wanna retain those value when i click the back button? You can't retain them, they are gone. You can only resend the data, which is not probably what you want. If you select 'No' from the popup, the form will be redisplayed, and may or may not retain the form elements as they were filled in before being submitted. The only other option, assuming you are requesting someone to press BACK in the case of form errors, is to redirect them via HEADER back to a new form. That form can either be blank, or you can pass the previous variables so that the new form is partially filled in. That requires quite a bit of overhead programming. PhREEEk Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 5, 2007 Share Posted November 5, 2007 maybe you can try session to hold your post data to eliminate that post warning message Quote Link to comment Share on other sites More sharing options...
kratsg Posted November 5, 2007 Share Posted November 5, 2007 My favorite workaround is to have the go-between. One page will handle the post, does the work, then redirects to another page. (which you can clear the last page history using javascript with on that page). This will eliminate the go-between from the history and you won't have any POST values to resubmit. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 5, 2007 Share Posted November 5, 2007 maybe you can try session to hold your post data to eliminate that post warning message The popup warning is coming from the client-side browser, so I'm not aware of anything script-wise (sessions or anything else) that will stop the popup. One of the best things to do here (assuming the back button is being used to correct form errors), is to use Javascript to check the form BEFORE it is sent back to the server. There shouldn't be a need to 'go back' at that point. Again, these popups are really very necessary. Many customers get double-billed at eCommerce sites because they think the process has stalled, so they press BACK and re-submit, which in turn racks up another transaction. The popup is giving you the CHOICE of resubmitting the POST data or not. That's a choice you ALWAYS need to be able to make. No browser can assume a default choice here, nor can you set one. Sometimes you will want to, and sometimes you won't. PhREEEk Quote Link to comment Share on other sites More sharing options...
kratsg Posted November 5, 2007 Share Posted November 5, 2007 What you can do is simulate the form. For example, have it post to a php page that SETS the sessions, echo out something as a confirmation. Then, if they confirm that it's correct, go to another page that checks the sessions (again) and processes the data. So if they go back, it's to the confirm page, and it won't affect transaction. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.