Google captcha not working
<p>I have a php login file and I want to put the google captcha in that login form. I use php and html together in one file (not sending the form data to other php page).
The problem is when users don't verify the captcha, they still can log in to the website (even captcha not verify). Here is my code:</p>

<pre><code>                    &lt;form action="" method="post" id="form"&gt;                        
                    &lt;div class="form-group"&gt;
                        &lt;div class="input-group"&gt;
                            &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-user"&gt;&lt;/i&gt;&lt;/span&gt;
                            &lt;input type="text" class="form-control" name="form-username" id="form-username" placeholder="Username" required=""&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;                        
                    &lt;div class="form-group"&gt;
                        &lt;div class="input-group"&gt;
                            &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-lock"&gt;&lt;/i&gt;&lt;/span&gt;
                            &lt;input type="password" class="form-control" name="form-password" placeholder="Password" id="form-password" required=""&gt;
                        &lt;/div&gt;
                    &lt;/div&gt; 

  &lt;div class="form-group"&gt;

                        &lt;div class="g-recaptcha" data-theme="dark" data-sitekey="my site key"&gt;&lt;/div&gt;

                    &lt;div class="form-group no-border margin-top-20"&gt;
                     &lt;input type="submit" name="submit" value="Sign In !" class="submit_button4 btn btn-primary btn-block" &gt;

   &lt;/form&gt;

&lt;?php
    if($_SERVER["REQUEST_METHOD"] === "POST")
    {
        //form submitted

        //check if other form details are correct

        //verify captcha
        $recaptcha_secret = "my secret key";
        $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&amp;response=".$_POST['g-recaptcha-response']);
        $response = json_decode($response, true);
        if($response["success"] === true)
        {
            echo "Logged In Successfully";
        }
        else
        {
            echo "You are a robot";
        }
    }
?&gt;
</code></pre>

<p>Note: also this code <code>&lt;script src='https://www.google.com/recaptcha/api.js'&gt;&lt;/script&gt;</code> is in my head tag (and all code is in one page).</p>