Making
Your Form Work
Now
that you've made a form, you need to make it work.
The
easiest and most common thing that people do is have
the contents of the form emailed to themselves.
Bama
has already set up the program you need to email the
contents. If you do not have your form on Bama, then
you will have to find out if your server has the program
set up, and if so, what is the address of the program.
Then you would follow the same instructions below, but
change the address to the one of your program on your
server.
Bama
uses a program called "FormMail." This program essentially
takes the contents of your form and emails it to you.
The main part of setting up your form to use FormMail
is making sure you have the proper fields in it. Some
will be hidden fields, while some will be fields you
may already have in your form.
Important:
You must put in field names exactly as they appear! Changing
the case, misspelling, or renaming a field will all cause
your form not to work properly.
Remember
that a field has a name that you give it when you set
it up and it also has a value, which is usually filled
in by the user. You can also set the default value, which
is especially important in hidden fields, which the user
cannot set a value for. When you are using a script like
FormMail, you must make sure that the names of particular
fields match what the script expects.
Hidden
fields are used to pass information to the script that
you don't want to be part of the visual form. These fields
are not completely hidden; they are easily viewable by
looking at the source code. Do not use hidden fields
as an alternative to security! The tag for a hidden field
is simple, and is very similar to the tags you've already
used:
<input
type=hidden name="name" value="value">
This
is the only required field. This is how FormMail knows
what e-mail address to send the information from the
form to. Put "recipient" as the name and your e-mail
address as the value.
<input
type=hidden name="recipient" value="emailaddress">
This
is very useful if the form information is being sent
to a mailbox that is used for other things, especially
other forms! Put "subject" as the name and the desired
subject line as the value. All e-mail from this form
will have the subject line you specify.
<input
type=hidden name="subject" value="subject
of your email">
If
you want FormMail to do some simple form validation for
you, simply tell it which fields must be filled in. If
the form is submitted without all the required fields,
the user will be directed to an error page, and the e-mail
will not be sent. Put "required" as the name and a list
of field names (separated by commas) as the value.
<input
type=hidden name="required" value="fieldname,
fieldname, fieldname">
To
connect your form to the FormMail script, make sure the
opening form tag looks like this:
<FORM ACTION="/cgi-bin/FormMail"
METHOD=POST>