Answer the question
In order to leave comments, you need to log in
Why does captcha not pass form data?
captcha is connected in the file with the form
include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/captcha.php");
$cpt = new CCaptcha();
$captchaPass = COption::GetOptionString("main", "captcha_password", "");
if(strlen($captchaPass) <= 0)
{
$captchaPass = randString(10);
COption::SetOptionString("main", "captcha_password", $captchaPass);
}
$cpt->SetCodeCrypt($captchaPass);
....
<form action="/reviews/finish.php" enctype="multipart/form-data" accept-charset="UTF-8">
<!--captcha_code-->
<input name="captcha_code" value="<?=htmlspecialchars($cpt->GetCodeCrypt());?>" type="hidden">
<input id="captcha_word" name="captcha_word" type="text">
<img src="/bitrix/tools/captcha.php?captcha_code=<?=htmlspecialchars($cpt->GetCodeCrypt());?>">
</form>
....
if(!$APPLICATION->CaptchaCheckCode($_POST["captcha_word"], $_POST["captcha_code"]))
{
// Неправильное значение
}
else
{
// Правильное значение
дальнейший код работы с формой
}
Answer the question
In order to leave comments, you need to log in
I forgot to add method="POST" in the form,
everything works
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question