Form fields ----- >>>>

<form action="/index.php" method="POST"></form> <div class="form"> <ul class="form-list"> <div class="form-list__item"> <input name="username" id="user" placeholder="Имя" type="text"><label for="user"></label> <input id="phone" name="phone" type="text" required placeholder="Контактный телефон"><label for="phone"></label> <input id="email" name="email" type="text" required placeholder="Электронная почта"><label for="email"></label> <input id="city" name="city" type="text" placeholder="Город открытия"><label for="city"></label> </div> </ul> <textarea id="msg" maxlength="100" rows="1" placeholder="Сообщение"></textarea><label for="msg"></label> <div class="capcha"> <div class="g-recaptcha" data-sitekey="6LcVbpEUAAAAAMMqmfsdsdsFs43AgogujrDTn9XiV"></div> 

 var captcha = grecaptcha.getResponse(); if (!captcha.length) { // Выводим сообщение об ошибке $('#recaptchaError').text('* Вы не прошли проверку "Я не робот"'); } else { // получаем элемент, содержащий капчу $('#recaptchaError').text(''); } if ((formValid) && (captcha.length)) { formData.append('g-recaptcha-response', captcha); } grecaptcha.reset(); if ($data.msg) { // вывести её в элемент у которого id=recaptchaError $('#recaptchaError').text($data.msg); } 
 PHP файл -------->>>>index.php <?php if (isset($_POST['g-recaptcha-response'])) { $url_to_google_api="https://www.google.com/recaptcha/api/siteverify"; $secret_key='6LcVbpEUAAAAAMAzzn07IEYTmdTFzYeFGBQvveZB'; $query=$url_to_google_api . '?secret=' . $secret_key . '&response=' . $_POST['g-recaptcha-response'] . '&remoteip=' . $_SERVER['REMOTE_ADDR']; $data=json_decode(file_get_contents($query)); if ($data->success) { // Продолжаем работать с данными для авторизации из POST массива } else { exit('Извините но похоже вы робот \(0_0)/'); } } else { exit('Вы не прошли валидацию reCaptcha'); } ?> 
 <form action="/index.php" method="POST"></form> <div class="form"> <ul class="form-list"> <div class="form-list__item"> <input name="username" id="user" placeholder="Имя" type="text"><label for="user"></label> <input id="phone" name="phone" type="text" required placeholder="Контактный телефон"><label for="phone"></label> <input id="email" name="email" type="text" required placeholder="Электронная почта"><label for="email"></label> <input id="city" name="city" type="text" placeholder="Город открытия"><label for="city"></label> </div> </ul> <textarea id="msg" maxlength="100" rows="1" placeholder="Сообщение"></textarea><label for="msg"></label> <div class="capcha"> <div class="g-recaptcha" data-sitekey="6LcVbpEUAAAAAMMqmfsdsdsFs43AgogujrDTn9XiV"></div> <div class="button-form"> <input value="Отправить заявку" id="submit" type="submit"><label for="submit"></label> 

  <div class="button-form"> <input value="Отправить заявку" id="submit" type="submit"><label for="submit"></label> 

    0