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
- Log in to your cPanel and select Email Accounts icon (Mail category).
- 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.
- Select Forwarders icon (Mail category) and click Add Forwarder button.
- 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
- In a text editor, open the .html page that contains your form.
- 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">
- Add three hidden fields to your form. These can be placed anywhere inside the form element.
- 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">
- 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">
- 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">
- Save the page.
- 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.
- Publish the page containing your form, as well as the redirect page.
- Open the page containing your form in a browser and test it. Fill in the form fields and submit the form.
- Check your email (Pipeline) to retrieve the data sent by the script.