Home > Tutorials and Resources > Processing Form Data Tutorial

Processing Form Data

By B Lingafelter          forms

Your student account at Butlercc Webhosting has a copy of the formmail.pl perl script that can be used to submit your user's form data via email. However, before you can use it, you must first setup an email account on your subdomain and then add the script and some hidden fields to your form.

Setup Email Account in cPanel

  1. Log in to your cPanel and select Email Accounts icon (Mail category).
  2. Create an email account for your subdomain i.e. support@your_subdomain.butlerccwebdev.net. You may use the same password you set for your cPanel login.
  3. Select Forwarders icon (Mail category) and click Add Forwarder button.
    Email: Add Forwarder
  4. Forward your new email account to your Butler pipeline email address. This makes it easier to retrieve any user form data submitted by the script, as you will not need to login to your cPanel just to check your email.

Add the script and related fields to your form

  1. In a text editor, open the .html page that contains your form.
  2. Edit the form element's action attribute to point to your formmail.pl script, and set the method attribute to post. It should resemble the following:
    <form id="contact" action="http://your_subdomain.butlerccwebdev.net/cgi-sys/formmail.pl" method="post">
  3. Add three hidden fields to your form. These can be placed anywhere inside the form element.
  4. Add a hidden field for recipient and set the value to your new email address.
    Example: <input type="hidden" name="recipient" value="support@your_subdomain.butlerccwebdev.net">
  5. Add a hidden field for subject and set a value to help you identify any messages sent by the script.
    Example: <input type="hidden" name="subject" value="FormMail Contact Information">
  6. Add a hidden field for redirect and set the value to the name of the page you want users to see after submitting the form.
    Example: <input type="hidden" name="redirect" value="http://your_subdomain.butlerccwebdev.net/path-to/thankyou.html">
  7. Save the page.
  8. Create a new .html page with the text message you want users to see after they submit the form. Be sure the name and location of this file matches the path specified in step 6.
  9. Publish the page containing your form, as well as the redirect page.
  10. Open the page containing your form in a browser and test it. Fill in the form fields and submit the form.
  11. Check your email (Pipeline) to retrieve the data sent by the script.