CCCam
CCCam

Reputation: 85

php form refresh send form again (prevent)

when a form is filled and send, if you refresh the page, its says that the form will send again. (submit the form again).

What is a good way to prevent this from happening? or kill this session?

any guidance in this?

thank you

Upvotes: 1

Views: 2768

Answers (3)

Adam Lukaszczyk
Adam Lukaszczyk

Reputation: 4926

You can use AJAX to send POST variables to server, so refreshing browser window problem will not be a problem.

Upvotes: 1

ThiefMaster
ThiefMaster

Reputation: 318768

If you keep displaying the form there is no reason to prevent this.

Otherwise - i.e. after the form has been submitted successfully - store any messages you need to display in your session and then redirect to whatever page you want to display. This ensures the user is moved away from the POSTed page.

Upvotes: 0

Xavinou
Xavinou

Reputation: 802

After processing the POST informations, do a

header('Location: your_url');
exit();

Upvotes: 3

Related Questions