M
M
Makfroy2017-08-13 16:17:28
PHP
Makfroy, 2017-08-13 16:17:28

How to add captcha to script?

Hello, there is a Php form script that sends several fields to the mail:

<?php
if($_POST['submit']) {
    $fio = substr(htmlspecialchars(trim($_POST['fio'])), 0, 1000);
    $email = substr(htmlspecialchars(trim($_POST['email'])), 0, 1000000);

    $from = 'form';
    $to = 'bla [email protected]';

    mail($to, "Имя: ".$fio, "Телефон: ".$email, 'From: '.$from);
    echo 'Заявка отправлена! Через 5 секунд вы вернетесь на главную страницу';
    header( 'Refresh: 5; url=/' );
}
?>

HTML:
<form action="send.php" method="post" name="contact_form" onsubmit="return validate_form ( );">
                    <input type="number" name="email" placeholder="Телефон" class="form-control" id="phone">
                    <br>
                    <input type="text" name="fio" placeholder="ФИО" class="form-control">
                    <br><br>
                    <input type="submit" name="submit" class="btn-theme btn-theme-sm btn-default-bg text-uppercase" value="Узнать цену">
                    </form>

How to insert google capcha into this form? Tell me please

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Twelfth Doctor, 2017-08-13
@verdex

https://developers.google.com/recaptcha/old/docs/php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question