Feb
17
2009

Simple Contact Form for WordPress: Redux

by   |  Posted in Downloads  |  13 comments

I have gone into this code and really cleaned it up to make it work properly with WordPress installs that are in subdirectories or wherever. I have also added a wicked little open source captcha script which I borrowed from the awesome folks at phpcaptcha.org to make the form 100 times more secure.

INSTRUCTIONS:

Upload the contact.php file and the secureimage folder to your current WordPress theme’s directory and then create a page in you admin panel. Choose “Contact” as your template and save the page as “Contact”. You need to have your permalinks set to Custom Structure or else you would need to change line 15 to something like ?p=123 (change 123 to the ID of your contact page).

About the author:

A freelance web developer living in Montreal who spends most of his time writing for this site and building Premium themes for WordPress. You can find him on Twitter @bavotasan.

Site5 Affiliate Link
If you liked this, please share it.
If you require help or support, please visit the Support Forum and ask all your questions there. Questions about themes or plugins posted in the comments below will not be answered.

Tags: , , , , , , , , , , , , ,

Short URL: http://bit.ly/aN9mtP

Discussion 13 Comments

  1. Chad on March 24, 2009 at 2:12 pm

    Hello,

    I wanted to use your contact form, but am not getting any mail back once I fill in the form and submit it. I followed instructions precisely, but am not receiving emails.

    Any help would be appreciated.

    Chad

    • c.bavota on March 25, 2009 at 12:05 am

      Hey Chad,

      Did you download the new contact form at the top or did you use the code at the bottom?

  2. orangzeb on June 1, 2009 at 5:43 pm

    how to make in in center of page ??? plz reply back on ma email..

  3. Chris on June 13, 2009 at 12:42 am

    Comments broken?

  4. kit on June 17, 2009 at 11:38 am

    killer contact form dude. was just wondering if you had a quick solution on how to show what fields were not filled out on the error page.

  5. kit on June 17, 2009 at 12:02 pm

    figured it out

    if (!$validationOK) {
    echo get_header();
    echo ”;
    echo ‘In-Depth Audit’;
    echo ‘There was an error with your message.’;

    if ($Name == '') {
    $errors .= '<p>Name was not filled out!</p>';
    }
    if ($Email == '') {
    $errors .= '<p>Email was not filled out!</p>';
    }

    echo $errors;
    echo '<p>Please try again.<br /><br /><a href="/solutions/indepth-audit/">Return to In-Depth Audit page</a>.</p>';
    echo '</div>';
    echo get_footer();
    exit;
    }

    • c.bavota on June 18, 2009 at 1:34 pm

      Thanks for the snippet of code.

  6. tsopics on August 5, 2009 at 10:43 pm

    good script
    thanks

  7. Lee on September 15, 2009 at 1:09 am

    Nice form! Good work.

  8. don luttrull on October 27, 2009 at 10:51 pm

    great script for sure

  9. Mathilde Nilles on December 10, 2009 at 5:36 pm

    I have received several calls to my mobile phone recently which I really want to find out who they belong to. I am having a few issues with payment to some people and need to find out which one to avoid…I have seen that search reverse phone number.com seems to be ok has not got very good write ups. One of the better ones I have seen is the Phone Detective at TopPeopleTracker.Com – has anyone tried it and if so, did you get the information you wanted?

  10. Olivia Smith on May 1, 2010 at 3:06 am

    WordPress is the best blogging platform ever. It is much better than Typepad and blogspot.`~’

  11. Salvia Divinorum on May 4, 2010 at 6:23 pm

    Can you create a code for a captcha that shows only letters? I think they’re less suitable to be read by those new programs used by spammers, maybe changing the type of letter things would be harder for them.