Basic Form Submission Handler

The History

Back in the early 2000’s, we catered a lot to Microsoft FrontPage users — one of the nice things with MSFP was that it had a form handler built in to the server side, if you were to publish your site with FrontPage Extensions.

Of course, FrontPage and FrontPage Extensions are not much more than a fading memory. Dreamweaver is king when it comes to web development these days, but there is no native form handling function built in to Dreamweaver.

For some time, in one form or anther, we have provided in our web templates some facility to process form data. So that, when someone hits “submit” on your form, something, somehow, bundles up that data, and sends you an email.

Recently, we developed a simple but handy little script that you can use, free of charge, to handle your form submissions.

The Problem

Primarily, most do-it-yourself web developers are not familiar with server side scripting languages. How do the form fields get from the web page, to your email box? It isn’t all that complicated, when boiled down to a few lines of PHP code, but suffice to say, if you get one thing wrong, it isn’t going to work.

Download Version 1.7The Solution

We put together a little script that simplifies the configurations. There is even a facility for using the Google reCAPTCHA facility, for blocking spammers.

We’ve include this in our web template download packages. And now, we’re offering it here for the community should you want to use it. While we are providing this form handling solution free of charge, should you want us to install, configure, or troubleshoot it for you, there may be a nominal fee for our time. You may contact us for more details.

You can download the latest version of the “process_form.php” script here, and then save it into the root folder of your website (where your index.htm “home page” resides).

Basic Instructions

  1. After downloading and saving the latest version of the “process_form.php” script to your local website’s root folder,, open it in your web editor
  2. Configure the settings found after line #50 as per the Configuration Guide below
  3. Be sure that any form that you use, uses: action="/process_form.php"
    Example: <form method="post" action="/process_form.php">
  4. Make sure you publish up the”process_form.php” script, as well as any page that contains your form(s), up to your web hosting space.
If you are transitioning from a “” form, the above steps are probably all you have to do, as version 1.7 of the form handler will take the from configurations that already exist in your form, and send along the data as per the configurations already defined within your form.

Basic Configuration Guide

Make sure to set up these default configurations within the process_form.php — if you use any settings within the form itself (such as those defined for the service), they will override the default settings. If there are no overriding settings in your form, then these default settings will be used.

Step #1
Change the send_to_email variable from “” to your own email address

Step #2
Change the send_from_email variable from “” to your own domain (no www prefix required) — try to use an email address that actually exists and is the from the same domain that this process_form.php script resides on. In other words, if this process script is on “”, then use an email address such as “”

Step #3 Optional NEW in v1.6
Update the “reply_to_field” variable to match the field name of the email field that your customer is filling out, so that whe you “reply” to the form submission email, your email program replies to your customer’s email address (and not the ‘send_from_email’ defined in Step #2) — see the video for more details

Step #4
Change the “confirmation_page” variable to an actual website URL that you want the user to be directed to when they successfully submit your forms.

Step #5 Optional
Change the “email_subject” variable

Step #6 Optional NEW in v1.7
Change the “message_format” variable to one of the following: standard, compact, html

  • standard – This is the default setting which uses a fair bit of white-space to display the results
  • compact – Most of the white-space is stripped, with the field name and field value being on the same line
  • html – The email is formatted as html, and the form fields data is rendered via an HTML table

Step #7
Make sure that the “action” attribute for your FORM tag, in your web page, points to this script, and the method is set to “post”. Example:

<form action="/process_form.php" method="post">

Step #8
Upload this script (as well as any page that may have your form in it that points to this script) to to your web server

Step #9
Submit a test submission from your form, on your server.

reCAPTCHA Setup Optional

reCAPTCHA is a free anti-spam solution provided from Google. In the latest version (version 2), most users no longer have to enter the letters/numbers seen in an image — instead, most users simply have to check a checkbox labeled “I’m not a robot”. To learn more about this, please visit

We no longer recommend or provide instructions for reCAPTCHA version 1 — if you are using an older version of the Form Submission Handler, we recommend you upgrade to the latest version. In previous versions, you had to download the recaptchalib.php however in the current version, we include it directly within the process_form.php

reCAPTCHA Step #1
Sign up for a reCAPTCHA key here:

Find the “Secret Key” provided in the Keys panel. Copy and replace the “YOUR_SECRET_KEY” with your Secret Key.

reCAPTCHA Step #2 Not Recommended to Change
If you must use reCAPTCHA version 1, you can change the version to “1” in the “recaptcha_version” variable. If you go with this route, you will need to download the “recaptchalib.php” file and save it into the main folder of your website. We do not recommend using Google reCAPTCHA version 1. We do not provide instructions any longer for recaptcha version 1.

reCAPTCHA Step #3A: Using A Single Form On A Web Page Basic
Paste this snippet in the location in your HTML form, where you want the CAPTCHA to display:
<div class="g-recaptcha" data-sitekey="YOUR_SITE_KEY"></div>
<script type="text/javascript" src=""></script>

Find the “Site Key” provided in the Keys panel . Copy and replace the “YOUR_SITE_KEY” (in the code shown above) with your Site Key (not the SECRET key).

reCAPTCHA Step #3B: Using Multiple Forms On A Web Page Advanced

  1. In each of your forms, where you want the reCAPTCHA to display, add a <div id='recaptcha-id'></div> snippet, and change the recaptcha-id to something unique.
  2. Copy and place the following snippet just above the closing </head> tag
    <script type="text/javascript">
    var onloadCallback = function() {
    grecaptcha.render(‘recaptcha-id’, {
    ‘sitekey’ : ‘YOUR_SITE_KEY’,
    ‘theme’ : ‘light’

    <script src=”” async defer></script>

  3. Copy and paste the
    grecaptcha.render('recaptcha-id', {
    'sitekey' : 'YOUR_SITE_KEY',
    'theme' : 'light'

    snippet that you pasted in your page, as many times as required.
  4. Change the “recaptcha-id” in each of those snippets to whatever the ids were that you created in step 3B-1
  5. You may change the theme to ‘dark’

reCAPTCHA Step #4
Upload your html page, with your changes, up to your web server.

Video Instructions