Hi,
I admit I am a novice with php right now. My problem is with this code that I copied from a tuitorial, and I keep getting back “You have not entered an email, please go back and try again.”
I’m hoping someone would help me and I would also like to send them a successful page a thank you page too.
Regards,
Lee Frandsen
<?php
require_once(‘recaptchalib.php’);
$privatekey = “6LcDacUSAAAAAJqFvJV5iOSsG8x6RnTLoIU6kg7s”;
$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
echo '
Please try again.
} else
{
$to = $_POST[‘[email protected]’];
$name = $_POST[‘name’];
$from = $_POST[‘email’];
$headers = “from: $from”;
$subject = “estimateform”;
$fields = array();
$fields{“name”} = “name”;
$fields{“phone”} = “phone”;
$fields{“businesstype”} = “businesstype”;
$fields{“email”} = “email”;
$fields{“company”} = “company”;
$fields{“designcheck”} = “designcheck”;
$fields{“pages”} = “pages”;
$fields{“forms”} = “forms”;
$fields{“optimize”} = “optimize”;
$fields{“presentsite”} = “presentsite”;
$fields{“admire”} = “admire”;
$body = “We have received the following information:\n\n”; foreach($fields as $a => $b)
{$body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = “From: [email protected]”;
$subject2 = “Thank you for contacting us”;
$autoreply = “Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.oursite.com”;
if($from == ‘’) {print “You have not entered an email, please go back and try again”;}
else {
if($name == ‘’) {print “You have not entered a name, please go back and try again”;}
else
{
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);}
}
}
?>