Email Form Script - Huggins' Email Form Script
James Huggins' Email Form Script is a free PHP script used to process Web Forms. It is specifically for those forms which accept information and send an email with that information to the specified email address. I have been using it for many years now on all of my sites.
To use this script, your web host must support at least PHP 5.1.
If you are using any of my template packages, you can use this sample contact form on your site. The sample package contains the following six pages/files:
- sample contact form
- sample thank you page
- sample error template
- form.css - external style sheet for the form and error template
- instructions for editing sample contact form
- background image used for form fields
Earlier versions of this sample form will NOT work with the latest version (2.2.5) of James script. You will need to download the latest sample form.
IMPORTANT: You MUST upload the script as ASCII. If you your FTP tool uses "autodetect" it might upload as BINARY instead of ASCII.
Editing the Contact Form Code
In order for the contact form to work for you, the following lines (highlighted) must be edited with YOUR information. Editing should be done BEFORE you attach any DWT you choose to use. Be extremely careful in editing the various lines that you do NOT delete (.) periods, (,) commas and (" ") quote marks.
The styling for the sample form as well as the error page comes from the attached external style sheet form.css. You can leave it attached or you can copy the styles into your already existing style sheet.
Line 14: <form id="contact" action="http://www.your-domain-name.com/huggins-email-form-script-v2.2.5.php" method="post">
Publish the php script to the root of your domain and change the highlighted text to your domain name. Make sure you are using the latest version of James script available from the link above. Make sure the path above points to exactly where the script is located and that the version numbers match. An earlier version of the sample form will NOT work with the latest script version 2.2.5.
The script that you download from James site has the name huggins-email-form-script-v2.2.5.php5.txt. NB: the file is distributed with a .txt suffix. Please rename by removing the final “.txt”. In addition, your server may not be able to process files named with a “.php5” extension. In this case, please change your file extension to “.php”.
Line 25: <input name="FormNextURL" type="hidden" value="http://www.your-domain-name.com/thank-you.html" />
Create a thank-you.html page and change the above highlighted text to your domain name or edit the enclosed thank-you.html.
Line 44: <input name="FormEchoUser" type="hidden" value="yes" />
Change to no if you do NOT want the user to receive a copy of the generated email.
Line 48: <input name="FormErrorPageHeading1" type="hidden" value="Test Error Form, , , , ,error-page-heading1" />
Change to the Text you want to appear as the H1 heading on your Error Page
Line 52: <input name="FormErrorPageTitle" type="hidden" value="Error Page - Sample Error Page" />
Change to what you want to appear at the top of the browser window for the error page.
Line 64: <input name="Msg1AddrList" type="hidden" value="FP2EW Tutors, tutors, frontpage-to-expression.com" />
Change to reflect your own email information
Line 72: <input name="Msg1Subject" type="hidden" value="Sample Contact Form" />
Change to what YOU want to see in the Subject of the email you receive.
Line 75: <input name="Msg1TextTop" type="hidden" value="I am testing the sample form to see how it works:" />
Change to what you want to see as the top line of text in the content of the email you receive.
Lines 89-97: These lines are used to indicate what will appear on the email the user of the form receives IF you want it to be different than the one you receive.
Working Sample of Form You will receive a copy of the email sent which is formatted in the same way as the copy of the form that is sent to the specified email address within the form.
IMPORTANT: If you are using an earlier version of the contact form, please note the following lines of code have changed (new code is shown):
<input name="FormErrorPageLinEClosing" type="hidden" value="Please press the BACK button ~ correct the errors and resubmit., , , , ,error-page-line-closing" />
<input name="FormErrorPageLineOpening" type="hidden" value="The form you submitted had the following errors:, , , , ,error-page-line-opening" />
<input name="FormErrorPageFooter" type="hidden" value=",,,,,error-page-footer" />
<input name="FormErrorPageErrorMsg" type="hidden" value=",,,,,error-msg" />
Examples of More Complex Forms:
As you can see from the above examples, there is much more available that you can do with Huggins' Email Form Script
Copyright © Pat Geary of Expression Web Tutorials and Templates
Written March 2011
Updated March 2013