lional Posted June 16, 2009 Share Posted June 16, 2009 I have a script, but if a user uses the back button I want the post data to be cleared. Is there a way to do this? Any help will be appreciated Quote Link to comment https://forums.phpfreaks.com/topic/162343-clearing-post-data/ Share on other sites More sharing options...
priti Posted June 16, 2009 Share Posted June 16, 2009 You can do a trick if its not the browser's Back button. If you have Back button <input type="submit" name="Back" value="Back"/> then on click of this you can redirect the user to location with some parameter passed like http;//previouspage url?btn=back and on the previous page you can put up the logic that if $_GET['btn'] is back then unset($_POST). But if its a browser's back button then I believe its going to be tuff. but you can follow below link for your help http://www.hunlock.com/blogs/Mastering_The_Back_Button_With_Javascript Quote Link to comment https://forums.phpfreaks.com/topic/162343-clearing-post-data/#findComment-857115 Share on other sites More sharing options...
premiso Posted June 16, 2009 Share Posted June 16, 2009 I have a script, but if a user uses the back button I want the post data to be cleared. Is there a way to do this? Any help will be appreciated Yes, once the user posts the form and the data gets entered do a header redirect to a "thank you" page. This will clear the post data, so if they push back it will not re-submit the data. Quote Link to comment https://forums.phpfreaks.com/topic/162343-clearing-post-data/#findComment-857127 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.