Soldato
- Joined
- 5 Aug 2003
- Posts
- 8,531
- Location
- Essex
I've tried to setup Recaptcha on an email form but I can't get it working, my code is below, I think I've followed all of the instructions for the PHP code so I must be missing something glaringly obvious. (I've removed the keys from the code below, although it's not hard to find them 
Page in question - http://mia-media.co.uk/ocuk/dbc/contact.html
contact.html Form Code
contact_verify.php

Page in question - http://mia-media.co.uk/ocuk/dbc/contact.html
contact.html Form Code
Code:
<form action="contact_verify.php" method="post">
<table width="672" border="0" cellspacing="5" style="background:#fff">
<tr align="left"><td width="113">Name</td><td width="540">
<input type="text" size="30" name="name"></td></tr>
<tr align="left"><td>Email address</td><td>
<input type="text" size="30" name="email"></td></tr>
<tr align="left"><td valign="top">Comments</td><td>
<textarea name="comments" rows="6" cols="30"></textarea></td></tr>
<tr align="left"><td> </td><td>
<?php
require_once('recaptchalib.php');
$publickey = "Key";
echo recaptcha_get_html($publickey);
?>
<tr align="left"><td></td><td>
<input type="submit" value="Send"><font face="calibri, arial" size="1"> <a href="http://FormToEmail.com">PHP Form</a> by FormToEmail.com</font></td></tr>
</table>
</form>
contact_verify.php
Code:
<?php
require_once('recaptchalib.php');
$privatekey = "Key";
$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
}
?>
Rest of FormtoEmail code
Last edited: