Need help with reCAPTCHA PHP Submission!! Easy question!?

Sujacob

New member
I can't seem to get this to work, I created a form that goes through reCAPTCHA, yet I have no idea how this works because I never deal with multiple action/php mail together.

For example, I have 3 files:

contact.php
verify.php (verify recaptcha)
submitform.php (php mail() submit)

-----------------------------------------------------------------------------------------------------
Contact.php (there's a lot more field that these below)

<form method="post" action="verify.php" name="contact">
Name <input type="text" size="40" name="namefrom">
Email <input type="text" size="40" name="emailfrom">

// recaptcha
<?php
require_once('recaptchalib.php');
$publickey = "publickey";
echo recaptcha_get_html($publickey);
?>

<input type="submit" />
</form>
----------------------------------------------------------------------------------------------------------------
submitform.php

define variable ($name = GET['namefrom']; etc)
mail(...)
-------------------------------------------------------------------------------------------------------------
verify.php

require_once('recaptchalib.php');
$privatekey = "privkey";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
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
}
?>
-------------------------------------------------------------------------------------------------------------


Is there anyway in the verify.php, if the recaptcha verification is correct,for it to go to submitform.php. -- but the problem with that, will the variable such as $name from the form get transferred also?

OR, is there another alternative?

Thanks!
 
Back
Top