newburcj Posted March 10, 2009 Share Posted March 10, 2009 I have an email form on my website that allows a patron to make reservations to our community theatre shows using php and FormToGo. It works great but sometimes because of a slow connection, the patron will click 'Submit' and it seems like nothing happened. So they click again, and maybe again. In one case the data was submitted seven times. Is there anyway I can disable the Submit button after it has been clicked once? This question has probably been answered before and I'd appreciate a point in the right direction. Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/148731-stopping-multiple-clicks-on-submit/ Share on other sites More sharing options...
ratcateme Posted March 10, 2009 Share Posted March 10, 2009 It is very easy with javasript try adding onclick="this.disabled=true" It should disable the button you mitt also want to look into changing the text so it says something like "processing" while it is disabled Scott. Link to comment https://forums.phpfreaks.com/topic/148731-stopping-multiple-clicks-on-submit/#findComment-780965 Share on other sites More sharing options...
btherl Posted March 10, 2009 Share Posted March 10, 2009 Another way is to use sessions to remember the last time the user clicked. Then only allow them to click once every 60 seconds (for example). This is simple to implement and effective for most situations. You do need to make sure the user can tell that the reservation was accepted though. Perhaps send them to a list of their reservations if they have their click rejected due to repeats. Link to comment https://forums.phpfreaks.com/topic/148731-stopping-multiple-clicks-on-submit/#findComment-781106 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.