Примечание. Неопределенная переменная: captcha в C: \ wamp \ projects \ ServiceAdmin \ login \ loginauth.php в строке 11

В настоящее время я создаю скрипт для входа в проект, но при попытке ввести капчу были обнаружены проблемы с ним; о которых я не совсем уверен.

Страница авторизации:

Форма:

введите описание изображения здесь

Код формы:

<div class="col-lg-8"> <script src="https://www.google.com/recaptcha/api.js"></script> <form class="form-signin" method="post" action="loginauth.php"> <h2 class="form-signin-heading">Sign in to ServiceAdmin</h2><br> <label class="sr-only">Email address</label> <input name="email" type="email" class="form-control" placeholder="Email address" required autofocus> <label class="sr-only">Password</label> <input name="password" type="password" class="form-control" placeholder="Password" required><br> </div> <div class="col-lg-4"> <div class="g-recaptcha" style="margin-top: 115px; margin-left: 20px;" data-sitekey="REDACTED"></div> <?php if($_SESSION['login.captcha']){ echo '<font color="red"><p style="margin-left:27px;">Please tick this checkbox to verify your security.</p></font>'; unset($_SESSION['login.captcha']); } else { echo '<p style="margin-left:27px;">Please tick this checkbox to verify your security.</p>'; } ?> </div><br><br> <input class="btn btn-lg btn-primary btn-block" type="submit" value="Sign in"> </form> 

Бэкэнд-код входа (loginauth.php):

 <?php error_reporting(E_ALL); $email = $password = $captcha = NULL; if(isset($_POST['email'])){ $email = $_POST['email']; } if(isset($_POST['password'])){ $password = $_POST['password']; } if(isset($_POST['g-recaptcha-response'])){ $captcha = $_POST['g-recaptcha-response']; } if(!$captcha){ echo "captcha error"; exit; } $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=REDACTED&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']); if($response.success==false){ "captcha error bot"; } else { "success"; } ?> , <?php error_reporting(E_ALL); $email = $password = $captcha = NULL; if(isset($_POST['email'])){ $email = $_POST['email']; } if(isset($_POST['password'])){ $password = $_POST['password']; } if(isset($_POST['g-recaptcha-response'])){ $captcha = $_POST['g-recaptcha-response']; } if(!$captcha){ echo "captcha error"; exit; } $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=REDACTED&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']); if($response.success==false){ "captcha error bot"; } else { "success"; } ?> , <?php error_reporting(E_ALL); $email = $password = $captcha = NULL; if(isset($_POST['email'])){ $email = $_POST['email']; } if(isset($_POST['password'])){ $password = $_POST['password']; } if(isset($_POST['g-recaptcha-response'])){ $captcha = $_POST['g-recaptcha-response']; } if(!$captcha){ echo "captcha error"; exit; } $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=REDACTED&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']); if($response.success==false){ "captcha error bot"; } else { "success"; } ?> 

Независимо от того, что, несмотря на заполнение captcha, оно не будет распознано как введенное и будет возникать с ошибкой как таковой:

 ( ! ) Notice: Undefined variable: captcha in C:\wamp\projects\ServiceAdmin\login\loginauth.php on line 11 

Если у кого-нибудь есть какие-либо идеи относительно причины этого вопроса, помощь будет оценена очень обильно.