3

I have a form for uploading images, and when I submit the form, and clicks the back button, the form executes again.

How do I keep that from happening?

form.php

<form action = 'action.php' method = 'POST'>
<input type = 'button' value = 'click me'>
</form>

action.php

//executes some codes...
//header off to home.php

Note:

It doesn't even have a pop-up that says something like:

"You're about to resubmit your form. Click OK to continue."

frosty
  • 2,559
  • 8
  • 37
  • 73
  • @fred-ii- But header is exactly what I am using, and in the answer, it says to use header... – frosty Dec 31 '15 at 00:59

1 Answers1

0

You could possibly try using a session_start() when the user hits submit (i'd likely put it at the top of action.php), then run a check to see if a session exists, if it does you could redirect the user back to the form.

That's probably how i'd do it, another method would be checking if the file already exists when the form is submitted, which is probably a bit more reliable than a session

DLMousey
  • 147
  • 2
  • 14