The Formmail CGI is a forms processor that emails the contents of a web form to a specified recipient(s). To use the "formmail.cgi" program on the NDSU web server, the form that is calling the program must also be on the NDSU web server.
Use the following instructions to incorporate the Formmail CGI script into your forms. In each section you will find instructions on how to use Dreamweaver to accomplish each task, and you will also find the HTML coding that would result.
Insert a Form into your Web Page:
First of all, you must invoke the Formmail CGI program by including the following line in your web file's
HTML code:
<FORM action="http://www.ndsu.nodak.edu/cgi-bin/formmail.cgi" method="POST">
For those of you who "don't do HTML," you can accomplish the same thing using Dreamweaver by inserting your
cursor where you want the form to start and choosing INSERT > FORM. A box will appear
on your screen, and the Properties window will change. In the Properties window, enter
"http://www.ndsu.nodak.edu/cgi-bin/formmail.cgi" into the ACTION box, and leave the
METHOD as POST. All of the form's fields must reside within this box.
Insert the Recipients Field:
There is only one required field, the "Recipients" field, in which you specify the person or persons who
will receive the results of the submitted web form. To add the "recipients" field to your form, place your
cursor inside the form box and choose INSERT > FORM OBJECT > HIDDEN FIELD. In the
changed Properties window set NAME to be "recipient" and
VALUE to be the full email address of the person(s) who will receive the form results. If
entering multiple recipients, separate each email address with a comma but not an extra space.
Please note that you can only use "@ndsu.edu" email addresses in this field. If the recipient normally
uses a different email, such as Groupwise, he/she will have to use a "@ndsu.edu" email address here and
then set the NDSU email address to automatically forward all mail to the Groupwise email address. (You can
set the forwarding of your email on the http://enroll.nodak.edu
site.)
The resulting HTML coding for the recipient field will look like:
<INPUT TYPE="hidden" NAME="recipient" VALUE="your.name@ndsu.edu">
Insert Optional Fields as Needed:
The following fields are not required, but may make your form and its results more effective. Please note that fields that are not "hidden" should have Labels so that the user will know what goes into the field. Example: Before the email field, you might display "Please enter your email address here:"
Insert Advanced Fields, if You Wish:
There are more defined form fields available for the FormMail program that are not normally used. If you are interested in using these advanced fields, please link to the FormMail Advanced Fields page for further instructions.
Insert Submit and Clear Buttons:
At the bottom of your form, within the dotted form box, you will need to insert a Submit button, or your
users will not be able to submit their data to you. You may also include a Clear button that clears all the
answers from the fields, giving the user a fresh start to the form.
To add a button in Dreamweaver, place your cursor inside the form box at the end of the form and choose
INSERT > FORM OBJECTS > BUTTON. In the Properties window, choose either
"Submit form" or "Reset Form", depending on whether this is a submit
button or a clear button. You can also change the LABEL that will appear on top of the
button to something other than "submit" or "clear" if you wish. You can even specify a phrase such as
"Send my answers."
The HTML equivalent is:
<INPUT
TYPE="submit" NAME="Submit" VALUE="Submit Form">
<INPUT TYPE="reset" VALUE="Reset Form">
followed by the </form>
tag.
Summary:
If you insert the typical amount of code explained below, you will have code like this at the start of your input fields:
<FORM action="http://www.ndsu.nodak.edu/cgi-bin/formmail.cgi" method="POST">
<INPUT TYPE="hidden" NAME="recipient" VALUE="your_name@ndsu.edu">
<INPUT TYPE="hidden" NAME="subject" VALUE="The title of your email goes here">
<INPUT TYPE="hidden" NAME="sort" VALUE="order:realname,email">
<INPUT TYPE="hidden" NAME="required" VALUE="realname,email">
<INPUT TYPE="hidden" NAME="missing_fields_redirect"
VALUE="http://www.ndsu.nodak.edu/directory/oops.htm">
<INPUT TYPE="hidden" NAME="redirect" VALUE="http://www.ndsu.nodak.edu/directory/thanks.htm">
<INPUT TYPE="hidden" NAME="env_report" VALUE="REMOTE_ADDR,HTTP_USER_AGENT">
And code like this at the end of your input fields:
<INPUT TYPE="submit" NAME="Submit" VALUE="Submit Form">
<INPUT TYPE="reset" VALUE="Reset Form">
</FORM>
THAT'S ALL THERE IS TO IT!
If you need help getting this to work, email Nancy Lilleberg at nancy.lilleberg@ndsu.edu with your questions.