PHP Contact Form
-
Download the contact form files.
-
Unzip the files. You'll find file called "contact_form.php" and a folder called "include" which contains a file called "recaptchalib.php".
-
Move the files to the local copy of your website so that "contact_form.php" is in the root of the site and "include" is a folder within the root, containing "recaptchalib.php", just as it did in the zip file.
-
If you haven't already done so, create a page, based on your site template called "contact.php" or similar.
Open "contact_form.php" with Textwrangler. Select and copy the CSS styles between where it says /* START CSS COPY/PASTE */ and /* END CSS COPY/PASTE */.
-
Edit "contact_form.php" in Dreamweaver in Code view. Select and copy all the content between where it says "<!-- Begin Copy / Paste -->" and where it says "<!-- End Copy / Paste -->".
Open the file that contains your CSS with Textwrangler and paste the styles into your CSS. Save and upload this file.
-
Paste this content into the content area of your "contact.php" file in Textwrangler or Notepad++.
-
Go to http://recaptcha.net/ and sign in using your google credentials (may require gmail account).
-
Click "+ Add a New Site", enter your domain (without the www) and click "Create Key"
-
Keep the browser page with your Public and Private keys open. You'll need them.
-
Return to editing "contact.php". Here, change $Recipient and $Subject to be what you want them to be. Make sure the email you enter as $Recipient is the email you want messages sent to.
-
For $privatekey, replace "REPLACE-WITH-PRIVATE-KEY-FROM-RECAPCHA-SITE" with your actual private key.
-
Further down the code, where you see some javascript, replace "REPLACE-WITH-PUBLIC-KEY-FROM-RECAPCHA-SITE" with your actual public key.
-
If you wish, edit the parts that say "Message successfully sent" and "Thank you for your correspondence! I will reply at my first convenience." to say what you would like them to say after someone sends a message.
-
Upload "contact.php" and test the page.