help with adding google captcha

Hi,
At this page here http://www.herbalwisdom.com.au/contact-us.html
I am trying to add googles captcha.  I followed these instructions (below link) to a T, but there is no captcha showing, and when you hit submit you get an error.

https://developers.google.com/recaptcha/docs/php

Please can someone help me get the captcha showing on this simple form?
Thanks
LVL 11
Amanda WatsonWeb DeveloperAsked:
Who is Participating?
 
Amanda WatsonWeb DeveloperAuthor Commented:
Solved it myself.
It didn't need to be a php at all .
I just had to write some code in verify.php for the google recaptch to work correctly which I did.
The veryify,php file required another php script to run for the form to work and I used sendresults.php
0
 
Dave BaldwinFixer of ProblemsCommented:
First, http://www.herbalwisdom.com.au/contact-us.html needs to be http://www.herbalwisdom.com.au/contact-us.php.  I can see the PHP code for the captcha in the view source because it is Not running as a PHP page.
0
 
Amanda WatsonWeb DeveloperAuthor Commented:
Oh my gosh, can I even do that in magento - I didn't even think of that!!!
But I was using sendresults.php originally to work the form, so I thought it would be ok, but yeah how do I insert php captcha into a html form?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Dave BaldwinFixer of ProblemsCommented:
By making it a PHP file.  All you have to do is change the file extension from 'html' to 'php'.  And this has nothing to do with Magento.
0
 
Amanda WatsonWeb DeveloperAuthor Commented:
ah, are you sure....I think it does have something to do with magento......Its a static block so the extensions are handled as a group?
0
 
Dave BaldwinFixer of ProblemsCommented:
Never heard of such a thing.  I have thousands of PHP files that have nothing to do with Magento.  In fact, I don't have Magento on anything.  I don't use it.

Have you tried it yet?
0
 
Amanda WatsonWeb DeveloperAuthor Commented:
I can't try it, I can't make the page php!!!!
0
 
Amanda WatsonWeb DeveloperAuthor Commented:
I added the code locally too, and changed the page name to php but the big captcha picture still didn't show.
I am doing something wrong with the code somewhere
<h3>Herbal Wisdom - Natural Foods, Health &amp; Massage</h3>
<p><strong>Address</strong> - 64 Byron Street, Bangalow, NSW, 2479</p>
<p><strong>Phone</strong> - (02) 6687 0457</p>
<p><strong>Email</strong> - <a href="mailto:peter@herbalwisdom.com.au">peter@herbalwisdom.com.au</a></p>
</br>
<p><iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com.au/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com.au/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004" style="color:#0000FF;text-align:left">View Larger Map</a></small></p>
<form id="contactForm" method="post" action="verify.php" >
<div class="fieldset">
</br>
<h2>Contact/Enquiry Form</h2>
<ul class="form-list">
<li class="fields">
<div class="field" style="padding:5px;"><label class="required" for="name"><em>*</em>Name</label>
<div class="input-box" style="padding:5px;"><input id="name" class="input-text required-entry" title="Name" type="text" name="name" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label class="required" for="email"><em>*</em>Email</label>
<div class="input-box" style="padding:5px;"><input id="email" class="input-text required-entry validate-email" title="Email" type="text" name="email" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label for="telephone">Telephone</label>
<div class="input-box"><input id="telephone" class="input-text" title="Telephone" type="text" name="telephone" value="" /></div>
</div>
<div class="field last" style="padding:5px;"><label for="order">Order Number</label>
<div class="input-box"><input id="order" class="input-text" title="Order" type="text" name="order" value="" /></div>
</div>
</li>
<li class="wide" style="padding:5px;"><label class="required" for="comment"><em>*</em>Comment</label>
<div class="input-box" style="padding:5px;"><textarea id="comment" class="required-entry input-text" title="Comment" name="comment" rows="3" cols="5"></textarea></div>
<li class="website" style="display:none">
    <input id="website" type="text" name="website" value="www.example.com/" />
</li>
<li><?php
          require_once('recaptchalib.php');
          $publickey = "6LetJvYSAAAAAAHfad8xPRPpF3UgbsDOsns5ZQ_O"; // you got this from the signup page
          echo recaptcha_get_html($publickey);
        ?>
</li>
</ul>
</div>
<div class="buttons-set" ><input id="hideit" style="display: none !important;" type="text" name="hideit" value="" /> <button class="button" title="Submit" type="submit"><span><span>Submit</span></span></button>
<p class="required">* Required Fields</p>
</div>
</form>

Open in new window

0
 
Amanda WatsonWeb DeveloperAuthor Commented:
Hey there, scrap this code,
This is better or closer I should say
.  But now there is no submit button??
Site is http://www.herbalwisdom.com.au/contact-us.html

<h3>Herbal Wisdom - Natural Foods, Health &amp; Massage</h3>
<p><strong>Address</strong> - 64 Byron Street, Bangalow, NSW, 2479</p>
<p><strong>Phone</strong> - (02) 6687 0457</p>
<p><strong>Email</strong> - <a href="mailto:peter@herbalwisdom.com.au">peter@herbalwisdom.com.au</a></p>
</br>
<p><iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com.au/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com.au/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004" style="color:#0000FF;text-align:left">View Larger Map</a></small></p>
<form id="contactForm" method="post" action="verify.php" >
<?php
     require_once('recaptchalib.php');
     $publickey = "6LetJvYSAAAAAAHfad8xPRPpF3UgbsDOsns5ZQ_O"; // you got this from the signup page
     echo recaptcha_get_html($publickey);
   ?>

<div class="fieldset">
</br>
<h2>Contact/Enquiry Form</h2>
<ul class="form-list">
<li class="fields">
<div class="field" style="padding:5px;"><label class="required" for="name"><em>*</em>Name</label>
<div class="input-box" style="padding:5px;"><input id="name" class="input-text required-entry" title="Name" type="text" name="name" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label class="required" for="email"><em>*</em>Email</label>
<div class="input-box" style="padding:5px;"><input id="email" class="input-text required-entry validate-email" title="Email" type="text" name="email" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label for="telephone">Telephone</label>
<div class="input-box"><input id="telephone" class="input-text" title="Telephone" type="text" name="telephone" value="" /></div>
</div>
<div class="field last" style="padding:5px;"><label for="order">Order Number</label>
<div class="input-box"><input id="order" class="input-text" title="Order" type="text" name="order" value="" /></div>
</div>
</li>
<li class="wide" style="padding:5px;"><label class="required" for="comment"><em>*</em>Comment</label>
<div class="input-box" style="padding:5px;"><textarea id="comment" class="required-entry input-text" title="Comment" name="comment" rows="3" cols="5"></textarea></div>
<li class="website" style="display:none">
    <input id="website" type="text" name="website" value="www.example.com/" />
</li>
<li>
<script type="text/javascript"
   src="https://www.google.com/recaptcha/api/challenge?k=6LetJvYSAAAAAAHfad8xPRPpF3UgbsDOsns5ZQ_O"
 </script>
 <noscript>
   <iframe src="https://www.google.com/recaptcha/api/noscript?k=6LetJvYSAAAAAAHfad8xPRPpF3UgbsDOsns5ZQ_O"
       height="300" width="500" frameborder="0"></iframe><br>
 </noscript>
</li>
</ul>
</div>
<div class="buttons-set" ><input id="hideit" style="display: none !important;" type="text" name="hideit" value="" /> <button class="button" title="Submit" type="submit"><span><span>Submit</span></span></button>
<p class="required">* Required Fields</p>
</div>
</form>

Open in new window

<h3>Herbal Wisdom - Natural Foods, Health &amp; Massage</h3>
<p><strong>Address</strong> - 64 Byron Street, Bangalow, NSW, 2479</p>
<p><strong>Phone</strong> - (02) 6687 0457</p>
<p><strong>Email</strong> - <a href="mailto:peter@herbalwisdom.com.au">peter@herbalwisdom.com.au</a></p>
</br>
<p><iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com.au/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com.au/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004" style="color:#0000FF;text-align:left">View Larger Map</a></small></p>
<form id="contactForm" method="post" action="verify.php" >
<div class="fieldset">
</br>
<h2>Contact/Enquiry Form</h2>
<ul class="form-list">
<li class="fields">
<div class="field" style="padding:5px;"><label class="required" for="name"><em>*</em>Name</label>
<div class="input-box" style="padding:5px;"><input id="name" class="input-text required-entry" title="Name" type="text" name="name" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label class="required" for="email"><em>*</em>Email</label>
<div class="input-box" style="padding:5px;"><input id="email" class="input-text required-entry validate-email" title="Email" type="text" name="email" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label for="telephone">Telephone</label>
<div class="input-box"><input id="telephone" class="input-text" title="Telephone" type="text" name="telephone" value="" /></div>
</div>
<div class="field last" style="padding:5px;"><label for="order">Order Number</label>
<div class="input-box"><input id="order" class="input-text" title="Order" type="text" name="order" value="" /></div>
</div>
</li>
<li class="wide" style="padding:5px;"><label class="required" for="comment"><em>*</em>Comment</label>
<div class="input-box" style="padding:5px;"><textarea id="comment" class="required-entry input-text" title="Comment" name="comment" rows="3" cols="5"></textarea></div>
<li class="website" style="display:none">
    <input id="website" type="text" name="website" value="www.example.com/" />
</li>
<li><?php
          require_once('recaptchalib.php');
          $publickey = "6LetJvYSAAAAAAHfad8xPRPpF3UgbsDOsns5ZQ_O"; // you got this from the signup page
          echo recaptcha_get_html($publickey);
        ?>
</li>
</ul>
</div>
<div class="buttons-set" ><input id="hideit" style="display: none !important;" type="text" name="hideit" value="" /> <button class="button" title="Submit" type="submit"><span><span>Submit</span></span></button>
<p class="required">* Required Fields</p>
</div>
</form>

Open in new window

0
 
Amanda WatsonWeb DeveloperAuthor Commented:
By the way that lady getting a massage is supposed to be in the left sidebar , but my code pushed it to the bottom....?
<h3>Herbal Wisdom - Natural Foods, Health &amp; Massage</h3>
<p><strong>Address</strong> - 64 Byron Street, Bangalow, NSW, 2479</p>
<p><strong>Phone</strong> - (02) 6687 0457</p>
<p><strong>Email</strong> - <a href="mailto:peter@herbalwisdom.com.au">peter@herbalwisdom.com.au</a></p>
</br>
<p><iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com.au/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com.au/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004" style="color:#0000FF;text-align:left">View Larger Map</a></small></p>
<form id="contactForm" method="post" action="verify.php" >
<div class="fieldset">
</br>
<h2>Contact/Enquiry Form</h2>
<ul class="form-list">
<li class="fields">
<div class="field" style="padding:5px;"><label class="required" for="name"><em>*</em>Name</label>
<div class="input-box" style="padding:5px;"><input id="name" class="input-text required-entry" title="Name" type="text" name="name" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label class="required" for="email"><em>*</em>Email</label>
<div class="input-box" style="padding:5px;"><input id="email" class="input-text required-entry validate-email" title="Email" type="text" name="email" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label for="telephone">Telephone</label>
<div class="input-box"><input id="telephone" class="input-text" title="Telephone" type="text" name="telephone" value="" /></div>
</div>
<div class="field last" style="padding:5px;"><label for="order">Order Number</label>
<div class="input-box"><input id="order" class="input-text" title="Order" type="text" name="order" value="" /></div>
</div>
</li>
<li class="wide" style="padding:5px;"><label class="required" for="comment"><em>*</em>Comment</label>
<div class="input-box" style="padding:5px;"><textarea id="comment" class="required-entry input-text" title="Comment" name="comment" rows="3" cols="5"></textarea></div>
<li class="website" style="display:none">
    <input id="website" type="text" name="website" value="www.example.com/" />
</li>
<li><?php
          require_once('recaptchalib.php');
          $publickey = "6LetJvYSAAAAAAHfad8xPRPpF3UgbsDOsns5ZQ_O"; // you got this from the signup page
          echo recaptcha_get_html($publickey);
        ?>
</li>
</ul>
</div>
<div class="buttons-set" ><input id="hideit" style="display: none !important;" type="text" name="hideit" value="" /> <button class="button" title="Submit" type="submit"><span><span>Submit</span></span></button>
<p class="required">* Required Fields</p>
</div>
</form>

Open in new window

0
 
Amanda WatsonWeb DeveloperAuthor Commented:
Ok I have it all working now, but how to do Send the code to a particular recipient?

There is a section in verify.php that says  

 // Your code here to handle a successful verification which is where I assume you send you form....but I don't know what to write to send the form or post it to a ricipient.....please help I am at a road block.............?
 <?php
 require_once('recaptchalib.php');
 $privatekey = "6LetJvYSAAAAAKHTJpHMxLFVT0JgYGjdx7sn8TS1";
 $resp = recaptcha_check_answer ($privatekey,
                                 $_SERVER["REMOTE_ADDR"],
                                 $_POST["recaptcha_challenge_field"],
                                 $_POST["recaptcha_response_field"]);
 if (!$resp->is_valid) {
   // What happens when the CAPTCHA was entered incorrectly
   die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
        "(reCAPTCHA said: " . $resp->error . ")");
		
 } else {
   // Your code here to handle a successful verification
 
 }
 ?>
   <?php echo 'Your form was sucsellfully submitted.'  ?>

Open in new window

0
 
Amanda WatsonWeb DeveloperAuthor Commented:
Sorry, but I did find the final solution
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.