This question is an exact duplicate:

There is some form

<form action="" method="post" id="form-vidguki"> 

in which the action field is empty, there is a captcha check in the form, the captti check is implemented in php. If the captcha is entered incorrectly, then it simply returns to the same page (add review page). If the captcha is entered correctly, it is necessary to carry out the action, after which the data is transferred from the form to the file adding a review to the database, how to do it? Or in a different way, how to implement action only after checking the captcha?

Reported as a duplicate by members aleksandr barakin , Streletz , tutankhamun , Grundy , user207618 Sep 30 '16 at 17:40 .

This question has been marked as a duplicate of an existing one.

  • specify the question and it is not clear why you need to call another action when you can do everything in the same way. - Naumov
  • I need to perform a single action, but on condition. If the action field in the form is not empty, then the data is sent regardless of the correctness of the captcha - Allter-Ego
  • one
    You reinvent the wheel with triangular wheels. The action at the form is one and leads to the script for processing the entered data. And already the script checks the captcha and if it is correct, it stuffs the data into the database. Otherwise, redirects to the input page. - ArchDemon Sep.

1 answer 1

 <form action="page.php" method="post" id="form-vidguki"> 

The form in any case should fly to the handler page.php it checks: 1. Completeness and correctness of filling 2. Captcha If everything is correct, the handler adds an entry to the database and the user then redirects to the right place. If it is not correct, then the user immediately redirects where it is necessary - back to the error page.