EDIT: I'm using reCaptcha 2.0, should I not be using recaptchalib.php?
Live DEMO http://josiahbertoli.com/
I'm getting the following error when I submit a form (ignore the blank values for the input fields)(with debug code):
Error
_POST: =========
Array
(
[first_name] =>
[last_name] =>
[email] =>
[subject] =>
[comments] =>
[g-recaptcha-response] => big-long-value
)
=========
The reCAPTCHA wasn't entered correctly. Go back and try it again.(reCAPTCHA said: )`
How my webpage is set up:
HTML
<form id="query-form" action="wp-content/themes/portfolio/submit-form.php" method="post" name="myForm">
<input id="first_name" name="first_name" size="35" type="text" placeholder="e.g. John" />
<input id="last_name" name="last_name" size="35" type="text" placeholder="e.g. Smith" />
<input id="email" name="email" size="35" type="text" placeholder="e.g. example@domain.com" />
<input id="subject" name="subject" size="35" type="text" placeholder="e.g. Feedback" />
<textarea id="comments" name="comments"></textarea>
<div class="g-recaptcha" data-sitekey="6Le8WxcTAAAAAGqymotU9wtOBFEmWgjM3j2kqTcB"></div>
<input type="submit" value="Submit" />
</form>
Submit uses method POST to call the action submit-form.php which is as follows
PHP
<?php
require_once('recaptchalib.php');
$privatekey = "the-key-that-i-put-in";
echo "<pre> _POST: =========\n"; print_r($_POST); echo "\n=========\n</pre>";
$resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
$resp = null;
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
include '../../../../process.php';
}
?>
Thank you for your responses, I appreciate it.