How to prevent multiple inserts when submitting a form in PHP?
问题 Sometimes the user may press Enter twice, and the post is inserted twice. Is there a solution to prevent this other than check if there is already a post with the same title and content ? 回答1: There are several solutions to this problem: 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