title: Show div element after reCaptcha validation
body: <p>I am using <a href="https://developers.google.com/recaptcha/" rel="nofollow noreferrer">Googles reCaptcha API</a> for form validation.</p>
  
  <p>I have opted to have the <code>submit</code> button show once the validation has been complete by using a little bit of JS.</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  if(isset($_POST['Login'])){
      $url = 'https://www.google.com/recaptcha/api/siteverify';
      $privatekey = '6LerNA0UAAAAAEReb9rS5JXjtvNSYlMjKiocUv_O';
  
      $response = file_get_contents($url."?secret=".$privatekey."&amp;response=".$_POST['g-recaptcha-response']."&amp;remoteip=".$_SERVER['REMOTE_ADDR']);
      $data = json_decode($response);
  
      if(isset($data-&gt;success) AND $data-&gt;success==true){
          //show submit button
          echo '&lt;script type=\"text/javascript\"&gt; 
              function myFunction() {
              document.getElementById("logDiv").style.visibility="visible";
              }
          &lt;/script&gt;';             
      }
      else{           // stay hidden
          '&lt;script type=\"text/javascript\"&gt; 
              function myFunction() {
              document.getElementById("logDiv").style.visibility="hidden";
              }
          &lt;/script&gt;'; 
      }
  }
  ?&gt;
  &lt;div id='logDiv' style='visibility:hidden')
  &lt;?php
  echo $form-&gt;add('Login',array('type' =&gt; 'submit'));
  ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Currently, the solution isn't working; when the Captcha is validated the div remains hidden.</p>
  
  <p>Is this a result of a syntax error or have a made a logical error?</p>
  
  <p>What is the bug in my code?</p>
  
  <p>Are there any more robust solutions?</p>