codeboy89 Posted December 1, 2009 Share Posted December 1, 2009 I have a simple contact form, and a user could refresh and submit it several times, what is the best way to fix this with PHP? Link to comment https://forums.phpfreaks.com/topic/183520-easiest-way-to-make-sure-form-is-only-submitted-once/ Share on other sites More sharing options...
Stuie_b Posted December 1, 2009 Share Posted December 1, 2009 Sessions would be my choice, would allow you to prevent multiple submitions with very little code changes stuie Link to comment https://forums.phpfreaks.com/topic/183520-easiest-way-to-make-sure-form-is-only-submitted-once/#findComment-968657 Share on other sites More sharing options...
Jnerocorp Posted December 1, 2009 Share Posted December 1, 2009 yea basically Stuie_b said use sessions <?php session_start(); // This starts the Sessions if(!isset($_SESSION['form'])) { // this checks if the session is set or not $_SESSION['form'] = "done"; // This sets the session // Place your form proccessing here } else { // If the Form is filled do the followin below echo "You have alredy Filled out the form"; // Displays the message if the form is already filled } ?> Link to comment https://forums.phpfreaks.com/topic/183520-easiest-way-to-make-sure-form-is-only-submitted-once/#findComment-968662 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.