Posts

Showing posts from May, 2017

Prevent multiple hitting while submitting form

There are several solutions to this problem: 1. Use Javascript to disable the form's submit button when it is posted.   Downside to this is that this is ABSOLUTELY not a foolproof way. It's very easy to submit forms without actually clicking the button, and this would also not work for users with JavaScript disabled.  I would definitely not recommend this method. Example: < script language=" javascript "> <!-- function disableSubmitButton () { // you may fill in the blanks :) } --> </script> <form action="foo.php" method="post"> <input type="text" name="bar" /> <input type="submit" value="Save" onclick =" disableSubmitButton ();"> </form> 2. Use   PHP sessions  to set a session variable (for example $_SESSION[' posttimer ']) to the current timestamp on post.   Before actually processing the form in PHP, check if the $_SESSION['post...