A
A
Anton2018-04-10 14:20:41
PHP
Anton, 2018-04-10 14:20:41

How to prevent form resubmission?

There is a form, if there is a product in the basket, then the form for sending the order is available, after the entered data about the client, the form is sent, the letters on the event go away. After submitting the form, a Thank You page appears.
The essence of the problem: after, for example, a couple of days, the client opens the browser on his smartphone and all his tabs are reopened, including pages that he did not close, and the form is resubmitted. The boss sees that a new order has arrived, but there are no goods in the order, which is logical, since after sending the basket is reset, and the client receives a letter again and he is at a loss.
It would be possible to make a redirect after the order, but after the order, you need to display the order number and other data about the successful shipment and order parameters. In other words, is it possible to prevent the form from being resubmitted without redirecting somewhere and without using captcha?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-04-10
@alexr64

The boss sees that a new order has arrived, but there are no goods in the order, this is logical, since after sending the basket is reset,

Why don't you check the availability of goods in the basket before placing an order?
You can redirect to the order information page.

A
Alexander, 2018-04-10
@Minifets

Use csrf-token on the form. Kill 2 birds with one stone, and get rid of re-sending and increase security.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question