2
On my system I have a form that adds products to a sale, using PHP and Mysql. It works beauty. When I add the product I go to another page that inserts the data and then back to the sales page.
The problem is that my online server sometimes takes a long time to respond to the request when I add the product and the page keeps loading. System users click several times on the products without waiting for the answer.
Result: On sale you are adding multiple products at once, because users submit multiple requests at once. The problems I have with this is that it cuts into my stock and brings serious problems to the company. I need my system to count a single click, even if the user tries to click several times on the product.
Does anyone know any solution for not having this POST resend in PHP or even in Javascript?
An example of the code:
<form action="insere-produto.php" method="post">
... campos do formulário
<button type="submit" class="btn btn-primary btn-block"><b>SALVAR</b></button>
</form>
Page that inserts the product:
... recebo os campos do formulário
... insiro o produto
header("Location:insere-produto.php");
die();
When your question is resolved, you don’t need to edit it by displaying the answer. Just click the accept icon in the answer that solved your problem. In case you marked the answer of another person and not mine. rs
– Vinicius.Silva