+ 1
How to prevent form resubmission on page reload without the use of $_SESSION?
I'm making a self-referencing sticky form. I need this type in order to display error and not to lose already input data of the user. The form works fine, give proper error and others except when the successful form page is reloaded the data got duplicated in my database. I have look up in Google for an answer but most of the answer use _$SESSION. So I don't even bother to read it. Mine is made following the tutorial of "head first PHP and MySQL" book. So if anyone have solved such a problem please teach me
6 Answers
+ 2
I see, then use unset($_POST['btnsbmt']) when mysql finished, so if you reaload, its not sended again.
It's confusing, because I don't have access to your code too :P
+ 2
Sure, try to comment when its ready, so I get the notification. Night!
+ 1
Giving a name to the submit button, and then check if it set:
if(isset($_POST['subbtn'])){sqlaction}
0
if anyone has a working code please post it in comment.
0
Nahuel my form was submitted successfully, even the success message echoed. When the same page which was success got reloaded the data that I recently enter again got resubmitted. I am looking for an answer to prevent this. The code you mention was in my code to prevent error on first entry of form(submit button not triggered for once). So if you understand my question and have an answer please. My question seems kinda confuse.
0
I will try your new code. I will upload my code somewhere and link it here tomorrow. Please check this post again tomorrow. I am on bed now. Thanks for the help Nahuel