treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Help: Contact Form not working in Wordpress.

  • I do not know enough about PHP to figure out what is wrong with my contact form. I'm hoping someone can help me fix my contact form. I'm sure it must be a simple fix but can't figure out what that fix would be.

    View the form here:
    http://aarongmoore.com/contact/

    This is the form's code:

    <?php get_header(); ?>

    <div id="contentbg">
    <div id="content">
    <?php
    $name = $_REQUEST['name'] ;
    $email = $_REQUEST['email'] ;
    $message = $_REQUEST['message'] ;
    $subject = $_REQUEST['subject'] ;
    require_once('recaptchalib.php');
    $privatekey = "6LcHMr0SAAAAABP9Yj_8lTa4b9mKqoel4JInB5ui";
    $resp = recaptcha_check_answer ($privatekey,
    $_SERVER["REMOTE_ADDR"],
    $_POST["recaptcha_challenge_field"],
    $_POST["recaptcha_response_field"]);
    ?>

    <?php if (!isset($_REQUEST['email'])) {
    header( "Location: http://www.aarongmoore.com/contact/&quot;);
    die; } ?>

    <?php if (empty($email) || empty($message)) { ?>
    <b>ERROR</>
    <br>E-Mail or message field(s) empty.
    <?php die; } ?>

    <?php if (!$resp->is_valid) { ?>
    <b>ERROR</>
    <br>reCaptcha was not filled in correctly.
    <?php die; } ?>

    <?php if ( preg_match( "/[\r\n]/", $name ) || preg_match( "/[\r\n]/", $email ) ) { header( "Location: http://www.aarongmoore.com/contact/&quot;);
    die; } ?>

    <?php else { mail( "talk@aarongmoore.com", "AGM Owl: $subject", $message, "From: $name - $email" ); } ?>

    </div>
    </div>
    <?php get_footer(); ?>
  • do you get any errors? click on the view source and read the page to see if there are any php errors. Also you might try using worpdress mail function.

    http://codex.wordpress.org/Function_Reference/wp_mail