Jump to content

Archived

This topic is now archived and is closed to further replies.

samantha_chan1

How to prevent user from hitting refresh button

Recommended Posts

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");?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.