I'm using a combination of JavaScript, php and HTML to create a contact form, but my reCaptcha does not seem to do anything. I can hit submit anytime with or without the reCaptcha and my php code will send the mail either way.
This is a cutout of the relevant code:
<form onsubmit="return validateForm(this)" action="../structure/process_email.php" method="POST">
--- (cut) ---
<div>
</form>
https://www.google.com/recaptcha/api.js
My HTML here refers to my php which is sending my emails, but i cant seem to get the reCaptcha to be required before hitting submit.
<?php
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: xxx <xxx@xx.com\r\n";
if (isset($_POST['submit'])) {
$email_to = 'xxx@xx.com';
$email_subject = 'example subject';
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$content = "From:"." ".$name."\n"."Email:"." ".$email."\n\n".$message;
mail($email_to, $email_subject, $content, $headers);
}
header('location:../contact_us/contact_us.html');
?>
0 comments:
Post a Comment