FormCGI is a flexible and secure form processor, which you can use
to receive form results by email, or write form output to a file.
FormCGI includes an extensive feature set, including validation of
required fields, support for
regular expression matching, and verification
of credit card numbers.
The following guide provides an introduction to creating forms, and
posting input to the form handler. Those already familiar with this
process may wish to skip the introduction, and proceed directly to the
list of available form parameters.
A form processor sample is available:
Protecting Your Email Addresses
Email addresses you include on your site, whether visibly on the page,
or within the HTML code, are vulnerable to malicious email harvesters.
This includes email addresses specified in forms. If you wish to
receive form results by email, please make sure you read our
Email & Spam FAQ before
adding your form to your site. This FAQ includes detailed information
about this issue, as well as steps you can take to protect your email
addresses.
Receiving Form Results by Email
You can receive form results by email as follows (replacing "you@yourname.com"
and "Message Subject" as appropriate):
<FORM METHOD="POST" ACTION="/cgi-t/form.cgi">
<INPUT TYPE="hidden" NAME="to" VALUE="you@yourname.com">
<INPUT TYPE="hidden" NAME="from" VALUE="you@yourname.com">
<INPUT TYPE="hidden" NAME="subject" VALUE="Message Subject">
{ continue with the form elements you require }
<INPUT TYPE="submit" VALUE=" Submit ">
</FORM>
Your form must include "to" and "from" email
addresses.
To prevent abuse of this script, the "to" value must be
a local address on your domain. To
receive form results via a 3rd party email address, simply configure
an email forward that points to the 3rd party email address, and enter
the forward as the "to" address.
Email forwards are easily configured from the "Email" area of your
account control panel.
Receiving Attachments by Email
You can also receive attachments along with your email results as
follows (replacing "you@yourname.com" and "Message
Subject" as appropriate):
<FORM METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="/cgi-t/form.cgi">
<INPUT TYPE="hidden" NAME="to" VALUE="you@yourname.com">
<INPUT TYPE="hidden" NAME="from" VALUE="you@yourname.com">
<INPUT TYPE="hidden" NAME="subject" VALUE="Message Subject">
{ continue with the form elements you require }
Attachment: <INPUT TYPE="file" NAME="userfile">
<INPUT TYPE="submit" VALUE=" Submit ">
</FORM>
As with the previous example, your form must include
"to" and "from" email addresses, and the "to" value must be
a local address on your domain.
If you use this option, you should add a required field for the
sender's email address. Do not open attachments from senders (or for
file types) that are not known to you.
Writing Form Results to a File
You can write form results to a file as follows (replacing "yourfilename"
as appropriate):
<FORM METHOD="POST" ACTION="/cgi-t/form.cgi">
<INPUT TYPE="hidden" NAME="filename" VALUE="yourfilename">
{ continue with the form elements you require }
<INPUT TYPE="submit" VALUE=" Submit ">
</FORM>
Form results are saved to your "cgi-out" directory,
which is one level above your document root ("htdocs"). ".fileform.txt"
will be appended to the "filename" value, so you do not need to specify a
file extension.
If you wish to be notified by email whenever form results are
written to your file, simply add the following field to your form
(replacing "you@yourname.com" as appropriate):
<INPUT TYPE="hidden" NAME="notifyto" VALUE="you@yourname.com">
Using FormCGI with SSL (Secure Server)
FormCGI functions identically on your normal web server (http://www.yourname.com/) and
your secure server (https://www.yourname.com/). However,
there are certain guidelines you should follow. For details, please see
the Secure Server Guide.
Advanced Options
FormCGI includes an extensive feature set, including many
additional parameters. Once you are familiar with basic functionality,
you can also learn about FormCGI's advanced features, including
additional form parameters,
regular expression matching, and
verification of credit card numbers.
|