I got the js to load but i can not figuer out how to verify without mail being passed through instead of caught out using googles example and watching you tube videos.

I am updating exisiting mail form that has validation on it.

I tried the php plugins but they wont even load, i understand the public and private key.

Really am puzzled by this if anyone would care to explain.

Member Avatar for LastMitch

@andyhunter

Really am puzzled by this if anyone would care to explain.

It would be helpful if you can post the code. I think you are using google one.

sorry i did have googles one but it would not work. I was using the php plugin but the javascript one loads i just can work out how to validate it before sending ?

actual sending of input

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<meta name="viewport" content="initial-scale=1, maximum-scale=1" />

<meta name="viewport" content="width=device-width" />

<title>Emailing sending to myself</title>



</head>



</head>



<body>



<?php

    // Your code here to handle a successful verification 

    $email_to = "somewhere@email.com";

    $name = $_POST["name"];

    $email = $_POST["email"];

    $url = $_POST["url"];

    $message = $_POST["message"];

    $text = "NAME: $name<br>

             EMAIL: $email<br>

             URL: $url<br>        

             MESSAGE: $message";

    $headers = "MIME-Version: 1.0" . "\r\n"; 

    $headers .= "Content-type:text/html; charset=utf-8" . "\r\n"; 

    $headers .= "From: <$email>" . "\r\n";

    mail($email_to, "Message", $text, $headers);

?>

</body>

</html>

the code for input

<form action="send.php" id="contact-form" class="form" method="post">
            <ul> 
                <li>
                    <p><strong>Name</strong> <em>(*)</em></p>
                    <input name="name" type="text" class="requiredField" />
                </li>

                <li>
                    <p><strong>E-mail</strong> <em>(*)</em></p>
                    <input name="email" type="text" class="requiredField email" />       
                </li>

                <li>
                    <p><strong>URL</strong> <em>(Optional)</em></p>   
                    <input name="url" type="text" />
                </li>

                <li>
                    <p><strong>Message</strong> <em>(*)</em></p>
                    <textarea name="message" rows="20" cols="30" class="requiredField"></textarea>        
                </li>                
                <li class="submit-button">
                    <input class="submit" type="reset" name="reset" value="Reset"/>
                    <input name="submit" id="submitted" value="Send Message" class="submit" type="submit" />
                </li>
            </ul>

        </form><!--END CONTACT FORM-->

i placed both javascript and php plugin above submit.

You can load the recaptcha with JS and than handle the answer with the PHP plugin. Just upload the php library to your site and add the following code to line 31 above:

  require_once('recaptchalib.php');
  $privatekey = "your_private_key"; //Chnage this to your private key
  $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
    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
    //Continue to Verify and then send your email
  }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.