Help Integrating Re-Captcha Into My PHP Form
Note: recaptchalib.php is available from recaptcha, but I cannot post the code here, as warrior forum restricts links until you have 15 posts. This code was unmodified, and uploaded to my server as directed by Recaptcha. Private message me, and I will send you an email, if you prefer.
The Form:
<div id="cos">
<center><u><h1>Please Fill In Your Information:</h1></u></center>
<div id="costext1">
<form method="POST" action="leads.php">
<table border="0" cellpadding="5">
<tr>
<td>
First Name: <br /> <input type="text" name="firstname" size="19"></td>
<td>
Last Name: <br /> <input type="text" name="lastname" size="19"></td>
<td>
Email: <br /> <input type="text" name="email" size="19">
</td>
<tr>
<td>
Phone Number: <br /> <input type="text" name="phone" size="19">
</td>
<td>
Age: <br /> <input type="text" name="age" size="19">
</td>
<td>Sex: <br /> <input type="radio" name="sex" value="male" /> Male
<input type="radio" name="sex" value="female" /> Female
</td>
</tr>
<tr>
<td>
Address: <br /> <input type="text" name="address" size="19">
</td>
<td>
City: <br /> <input type="text" name="city" size="19">
</td>
</tr>
</table>
</div>
<div id="costext2">
<table cellpadding="5" border="0">
<tr>
<td>
What procedure are you interested in?: <br />
<SELECT NAME="procedure">
<OPTION VALUE="Botox">Botox
<OPTION VALUE="Laser Hair Removal">Laser Hair Removal
<OPTION VALUE="Hyaluronic Acid">Hyaluronic Acid
<OPTION VALUE="Chemical Peel">Chemical Peel
<OPTION VALUE="Laser Skin Resurfacing">Laser Skin Resurfacing
<OPTION VALUE="Breast Augmentation">Breast Augmentation
<OPTION VALUE="Breast Reduction">Breast Reduction
<OPTION VALUE="Breast Lift">Breast Lift
<OPTION VALUE="Breast Nipple Elevation">Breast Nipple Elevation
<OPTION VALUE="Buttocks Augmentation">Buttocks Augmentation
<OPTION VALUE="Liposuction">Liposuction
<OPTION VALUE="Eyelid Surgery">Eyelid Surgery
<OPTION VALUE="Non Invasive Tightening">Non-Invasive Tightening
<OPTION VALUE="Nose Job">Nose Job
<OPTION VALUE="Abdominoplasty">Tummy Tuck (Abdominoplasty)
<OPTION VALUE="Microdermabrasion">Microdermabrasion
<OPTION VALUE="Gynecomastia">Gynecomastia
<OPTION VALUE="Hair Transplant">Hair Transplant
<OPTION VALUE="Arm Procedures">Arm Procedures
<OPTION VALUE="Ear Surgery">Ear Surgery
<OPTION VALUE="Eyebrow Lift">Eyebrow Lift
<OPTION VALUE="Light Facial">Liquid and Light Facial
<OPTION VALUE="S Lift">Boutique S-Lift
<OPTION VALUE="Chin Implants">Chin Implants
<OPTION VALUE="Cheek Implants">Cheek Implants
<OPTION VALUE="Circumcision">Circumcision
<OPTION VALUE="Calf Implants">Calf Implants
<OPTION VALUE="Enlargement">Enlargement
<OPTION VALUE="Face Lift">Face Lift
<OPTION VALUE="Neck Lift">Neck Lift
<OPTION VALUE="Female Parts Surgery">Female Parts Surgery
<OPTION VALUE="Other Implants">Implants
<OPTION VALUE="Keloids">Keloids
<OPTION VALUE="Lip Enhancement">Lip Enhancement
<OPTION VALUE="Liposculpture">Liposculpture
<OPTION VALUE="Lesions">Lesions
<OPTION VALUE="Nose Implants">Nose Implants
<OPTION VALUE="Nose Reshaping">Nose-Reshaping
<OPTION VALUE="Rhinoplasty">Nose-Rhinoplasty
<OPTION VALUE="Suture Lift">Suture Lift
<OPTION VALUE="Skin and Wrinkle Treatments">Skin and Wrinkle Treatment
<OPTION VALUE="Vericose and Spider Veins">Vericose and Spider Veins
</SELECT>
</td>
</tr>
</table>
</div>
<div id="comwrap">
<table celllpadding="5" border="0">
<tr>
<td>
Comments: <br /> <textarea rows="3" name="message" cols="45"></textarea> <br /><br /></td>
</tr></table></div>
<table cellpadding="10">
<tr>
<td>
<?php require_once('recaptchalib.php');
$publickey = "6LfoJgsAAAAAAMsA-8ujJwc-9Ige3plEqJ0VuHbS";
echo recaptcha_get_html($publickey); ?>
</td>
<td>
<center><input type="submit" value="Submit Details" name="submit"></center>
</td>
</tr>
</table>
</form>
</div> <?php
$to = "email goes here";
$subject = "New Lead";
$firstname_field = $_POST['firstname'];
$lastname_field = $_POST['lastname'];
$phone_field = $_POST['phone'];
$email_field = $_POST['email'];
$age_field = $_POST['age'];
$sex_field = $_POST['sex'];
$address_field = $_POST['addresss'];
$city_field = $_POST['city'];
$message = $_POST['message'];
$procedure_field = $_POST['procedure'];
$body = "First Name: $firstname_field\n Last Name: $lastname_field\n E-Mail: $email_field\n Phone Number: $phone_field\n Age: $age_field\n Sex: $sex_field\n Address: $address_field\n City: $city_field\n Interested In: $procedure_field\n Comments:\n $message";
require_once ('recaptchalib.php');
$privatekey = "6LfoJgsAAAAAAEJpEt8BDGOzM54rqIz2JxkqY0T8";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid)
{
$result="The Captcha was Entered Incorrectly. Please Go Back and Try Again.";
}
else if ($resp->is_valid)
{
$result="Your Form Has Been Submitted. A doctor will be in touch soon!";
mail($to, $subject, $body);
}
echo $result;
?> -
phpbbxpert -
Thanks
{{ DiscussionBoard.errors[3350723].message }} -
-
KirkMcD -
Thanks
{{ DiscussionBoard.errors[3351999].message }} -
-
voitenkos -
Thanks
{{ DiscussionBoard.errors[3556222].message }} -