This script e-mails you the data that a user fills out on an HTML form.When the user submits the form, the script displays a generic thanks page. You can override this, and design your own HTML echo page with all the usual Web page design elements that you'd like to use (except that you can't use server-side includes or PHP on pages that use this feature). Or you can redirect the user to any page on the Web.
The script sends you the data from the form. It also can send a copy to the user who filled out the form, if the user supplies an e-mail address and if you've enabled this feature on your form.
If you wish, you can associate one or more text files with each form, that can be mailed to the user, along with (or optionally without) a confirmation listing of the form data.
Usage
Edit the "action=" part of the <form> tag on your HTML form, like this:<form method="POST" action="http://www.your.org/cgi-bin/sendform.cgi"> or <form method="POST" action="/cgi-bin/sendform.cgi">This forms processing script runs on the Unix server. The HTML form can be on another server (Unix, NT, Mac or other), as long as that server is included in the @GoodReferrers list in the script.
You can include any of these anywhere between the <form> and </form> tags. They're all optional except "to" (and if your e-mail address is the default address in the script, even that's optional).These variables are all case sensitive. The mail-related "email", "to", "to_name", "cc", "subject", "first_name", "last_name" and "name" fields are all lowercase letters. The other variables are capitalized as noted below.
Mailing the Data
"to"
First, put your e-mail address in the "to" field, so the script can mail the data to you.<input type="hidden" name="to" value="you@your.org">You can mail the data to more than one address, like this.<input type="hidden" name="to" value="you@your.org, other@your.org">If you want to do everything as simply as possible, you can stop reading right now, because "to" is the only script control field you really need.You can also include a "to_name" field, so the recipient can see your name as well as your e-mail address.
<input type="hidden" name="to_name" value="Your Name">"cc"
Another way to mail the results to more than one person is to use the "cc" field.<input type="hidden" name="cc" value="other@your.org, someone@your.org">You can also include a "cc_name" field, so the recipient can see the cc: name(s) as well as the e-mail address(es).<input type="hidden" name="cc_name" value="Tom A., Dick B., Jane C.">"subject"
The "subject" variable is optional. If not specified on the form, the default is "Web Form Data"<input type="hidden" name="subject" value="My Own Subject Line">"SubjectField"
<input type="hidden" name="SubjectField" value="name,phone">"SubjectField" copies whatever the user enters as the contents of a specified form field (or fields) onto the message's subject line.You can use "SubjectField" with or without using "subject." If you use them both, then the SubjectField data will follow the fixed "subject" data. For example, if the "subject" for a particular form is "XYZ Request" and the variable subject fields are name and phone, the message's complete subject line would be
XYZ Request - John Doe - (800) 555-1212
"SkipBlankFields"
<input type="hidden" name="SkipBlankFields" value="yes">"SkipBlankFields" lets you avoid wading through lots of blank fields in form data from long forms that may contain hundreds of fields but few required fields.
This is optional. If you don't want to use this feature, remove the above hidden line from the form. Whether or not it's used, unchecked checkboxes will not appear on the form results. (However, checkbox fields can be required in the Required field.)
"MailLastNameFirst"
<input type="hidden" name="MailLastNameFirst" value="yes">"MailLastNameFirst" is optional. If you include this field on the form, the mail sent by the script comes from "Johnson, Bob" instead of "Bob Johnson." If you don't want to use this feature, remove the above hidden line from the form.This works only if the form includes fields named "first_name" and "last_name", and both fields are filled out. These field names must be in lowercase, and must include the underscore.
If one but not both of the specially named first_name and last_name fields is on the form (or both are on the form but only one is filled out), the user's e-mail address will be "Johnson"
or "Bob" . If neither "first_name" nor "last_name" is on the form (or neither is filled out), the user's e-mail address will be bob@some.com.
Responding to User Input
"Required"
"Required" can apply to any of the data fields that the user fills out. The script won't accept the form unless the user puts something (anything) in the required fields. The script doesn't validate the data from any field except "email", which it checks minimally. In any other field, the user can enter "qwerty" and the script will accept it.For select boxes, you can use value="required" as the value of an empty option. This is equivalent to value="" but works with more browsers.
<select> <option value="required">Pick one <option value="Some value>Some value <option value="Other value>Other value </select>If the form contains a field named "email", the script automatically uses it as part of the mail header. The special "email" field name is case sensitive. The "email" field isn't required, unless you include it in the Required list. If it's not required and not filled out, then the script uses the MailtoAddress on the form or the DefaultTo address in the script for "From:" when it mails you the form results.
It's a good idea to use required fields sparingly. Users dislike them, especially if they ask for "none of your beeswax" information. Ask yourself, "Would the data be useless without this field, or not?"
<input type="hidden" name="Required" value="last_name,first_name,email">"email"
This is the user's e-mail address. This field must have the exact name "email" (case sensitive) if the script is to send a message to the user. You can make "email" a required field or not. Even if it's not required, the script checks the address for a typical Internet mail address format, because it uses the address to send a duplicate copy of the data to the user. If the address isn't in the usual format, the script won't accept it."BlurbFilePath"
Blurb files are files that you can optionally mail to people who fill out the form and who have included an e-mail address for you to contact them. If you send a blurb, it will be sent in the e-mail body, not as an attachment. The blurb(s) will be sent along with the e-mailed listing of forms fields confirming the data that the user entered on the form. Even if you choose not to send a confirmation listing for a given form, you can still send blurb files related to that form.You can specify one or more blurb files for each form. Give the full file path for each file. (This is an absolute path from the server root, not a URL.) The file path must start with a / character, and must be within the Web document area(s) or other document area(s) defined in the script by your site's Web administrator.
When processing a form page on a remote server, the blurb file(s) must reside on a file system readable by the Web server running the forms processor.
<input type="hidden" name="BlurbFilePath" value="/somedir/you/blurb-sample.txt">No default blurb is sent, in the absence of a specific text file defined this way for each form.
"first_name"
If the user fills out the "first_name" or "last_name" fields, the script includes them as part of the user's e-mail address.
"last_name"
"name"If the form includes a "first_name" field and the user fills it out, the script uses that for the salutation for the mail blurb.
In teh absence of first_name oe last_name, the script will use the "name" field, if present, for the user's name in the e-mail address. The script doesn't use "name" in the salutation for the blurb. If there's no "first_name", it skips the salutation.
Generic Thanks Page
When the user presses the submit button, the script by default displays a generic thanks page. It lists the data entered on the form and indicates where the script mailed the results. If the form includes an "email" field and the user fills it out, the script can mail a duplicate copy of the data to the user, if you've enabled this on your form page.All of the following variables are optional, and apply only to the default generic thanks page. You probably won't need to use them.
"ReturnLinkURL"
The generic thanks page includes a link back to the form, with the title "Return to the Form." You can substitute a link to any other page, like this. These variables are only for the generic thanks page, not for your own HTML echo page or a redirected page (see below).
"ReturnLinkTitle"<input type="hidden" name="ReturnLinkURL" value="/rec/curling/"> <input type="hidden" name="ReturnLinkTitle" value="The Curling Page">"MailtoPrompt"
The default e-mail link is to the "to" address on the form. If you want to display a different mailto link, you can do it like this.
"MailtoName"
"MailToAddress<input type="hidden" name="MailtoAddress" value="other@your.org"> <input type="hidden" name="MailtoName" value="Betty B. Boomer">The default prompt for the mailto link is "Questions:" but you can change that too, with this line:<input type="hidden" name="MailToPrompt" value="For more info:">HTML Echo Page
You can define your own HTML echo page for each form. You can use the echo page to say something appropriate to the user after submitting the form, or simply to display your own images and links on a nicer looking page."EchoFilePath"
<input type="hidden" name="EchoFilePath" value="/somedir/you/public_html/thanks-sample.html">"EchoFilePath" is optional. If it's omitted, the script displays a generic thanks page when the user presses the submit button. To use your own HTML echo page, specify its absolute file path from the base of the file system. (The file path must start with a / character and include the complete path to the file, and the filename.) This is a complete file system path, not a URL relative to the Web server's document directory.You can use .html or .htm as a file extension for your echo page. The script won't read files with other than these file extensions, unless you add more file extensions in the script's config section. The script will display an HTML file only if it is within one of the Web document paths defined in the script. You can't use any file path that starts with a dot (.) or that contains .. in the path.
You can design your HTML echo page however you like, except that you can't use server-side includes or PHP on pages that use this feature. You can include your own mailto and return links. The script doesn't automatically include these, as it does on the generic thanks page.
If you want the script to display the user's input data on your echo page, include the following comment line in the file, where you want the user data to appear.
<!--ECHO DATA HERE-->Redirection to Another Page
"RedirectURL"
To display a page on another server when the user presses the submit button, you can use the RedirectURL variable. It's not possible to echo user data from the form onto a redirected page.<input type="hidden" name="RedirectURL" value="http://www.any.org/page.html">If the page is on your server, you can shorten this to a relative URL.<input type="hidden" name="RedirectURL" value="/somedir/hi.html">
You can include any other data fields, and name them whatever you like. The script echoes the name and contents of each field in its echo page output and in the e-mail that it sends, except that it skips checkboxes that aren't checked.<input type="text" size="48" maxlength="80" name="Shoes">
The script compares the IP address of the server that submitted the form against a list of allowable servers. If the form submission comes from a domain that's not listed, the script won't read the input from the form. This isn't foolproof, but it helps prevent people at other domains from processing their forms with your mail and Web servers for squirrelly purposes.