K
K
kebirov_12019-05-08 13:09:42
PHP
kebirov_1, 2019-05-08 13:09:42

How to do a reCAPTCHA check?

There is a form with inputs and with google recaptcha
Data from the form is sent to
server.php
pages

<form action="server.php" method="POST">
    <input type="text" name="name" placeholder="Ваше имя">
    <input type="phone" name="phone" placeholder="Ваш телефон">
    <input type="text" name="email" placeholder="Ваша почта">
     <div class="g-recaptcha" data-sitekey="6LcCsWoUAAAAAO520lKAXtblM0p76KNXL3n0dVUZ"></div>
    <button type="submit" name="submit">Отправить</button>
</form>

server.php
if(isset($_POST['submit'])){
$to = "[email protected]";  
$from = "[email protected]"; 
 
$name = $_POST['name'];
$phone = $_POST['phone']; 
$email = $_POST['email'];    
     
/* Переменная, которая будет отправлена на почту со значениями, вводимых в поля */
$mail_to_myemail = "
Имя: $name
Номер телефона: $phone
Почта $email";  
     
$headers = "From: $from \r\n";
     
/* Отправка сообщения, с помощью функции mail() */
mail($to, $mail_to_myemail, $headers . 'Content-type: text/plain; charset=utf-8');
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Gorelov, 2019-05-08
@Kirill-Gorelov

backend

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question