Will the following stop accidental duplicate entries in my database if the user posts a form and then clicks the browser refresh button?
<?php
if( $_SERVER['REQUEST_METHOD']=='POST' ) {
try {
// write to database
} catch($e) {
// error reporting
}
}
?>
Use Post-Redirect-Get pattern – redirect always after data were successfully submitted.