samantha_chan1 Posted April 10, 2006 Share Posted April 10, 2006 How could i prevent a user from hitting the refresh button in the browser?If the user hit the refresh button, the data will then be posted to database as a new record with a new primary key which i have set it as an auto increment primary key. How can i avoid this from happening?what is the difference between using (1)include "hello.php" and (2) header (Location:"hello.php");? Quote Link to comment https://forums.phpfreaks.com/topic/7003-how-to-prevent-user-from-hitting-refresh-button/ Share on other sites More sharing options...
Prismatic Posted April 10, 2006 Share Posted April 10, 2006 1.) No, you cannot stop them from refreshing. Just code better to prevent double entries.2.) include loads the file into the current script, header("Location: xxx") will redirect you to that page. Quote Link to comment https://forums.phpfreaks.com/topic/7003-how-to-prevent-user-from-hitting-refresh-button/#findComment-25421 Share on other sites More sharing options...
Yesideez Posted April 10, 2006 Share Posted April 10, 2006 As an extra from Prismatic, you can disable or remove the submit button [in a form] after its been clicked to prevent users clicking it more than once but for this you'd need to add a little javascript to hide it once pressed - surprised how many people keep clicking adding more data on a slow connection. Quote Link to comment https://forums.phpfreaks.com/topic/7003-how-to-prevent-user-from-hitting-refresh-button/#findComment-25422 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.