Science Teaching Series

Internet Resources

I. Developing Scientific Literacy

II. Developing Scientific Reasoning

III. Developing Scientific Understanding

IV. Developing Scientific Problem Solving

V. Developing Scientific Research Skills

VI. Resources for Teaching Science

Developing forms using

cgiemail mail

(see also CSUN cgi-email page)

The purpose of cgiemail, a cgi program written in C for UNIX, is to take the input from a WWW form and convert it to an e-mail format defined by the form's author.

This guide will help you write a WWW form that sends an e-mail message to you. The following steps are required.

  1. Create an e-mail template.
  2. Upload e-mail template as text file
  3. Create the HTML form.
  4. Make sure the ACTION is correct.

1. Create an e-mail template.

Before you start receiving e-mail messages through the web, you should decide what these messages should look like. Create an ASCII file, called an e-mail template, that looks something like this:

Subject: Computer Service Request

EMAIL FROM: [email]

  1. Wherever you want the user of your form to supply information, use a single word inside square brackets with no spaces, e.g. Your name: [yourname]. Not [Put your name here.].
  2. Line three should be blank, but no others should be blank.

2. Upload e-mail template as text file

  1. Save your email template as a text file with the file extension name .txt.
  2. Upload this text file into your account. Take note of the location of this file as it will need it below. In this example the file is uploladed to
  3. If you created the file on a Mac, be sure to upload it as text. (Unix computers have different codes denoting the end of a line than Mac's do, so your file might look like one long line to the Unix computer.) Note: if you do not upload as text, you will get an Internal Server Error when trying to use the form.

3. Create the HTML form.

Here is an sample form that correponds to the email text file above.:

Please enter your email.

Please enter the tag number of the computer.

Please describe the problem.


4. Set the ACTION in html

View the html in your web page (source code).

For the example above it will look something like this:

<form method="POST">
<p><input type="text" size="32" name="email">Please enter your email.</p>
<p><input type="text" size="32" name="tag">Please enter the tag number of the computer.</p>
<p><textarea name="problem" rows="3" cols="39"></textarea> Please describe the problem.</p>
<p><input type="submit" name="B1" value="Submit"></p>

Find the html that starts the form command and insert the path to the file, including the cgi-bin script for the server that you are using, usin gthe action command:

<form action=""

On the CSUN server, the script is : cgi-bin/cgiemail. the

The blue text om the action comand indicates the path to the email text file. Note that the cgi-emai scrpit has been inserted after the server, but before the account. ""


To learn to create more complicated forms, read NCSA's guide. For now, simply note that the NAME of each input corresponds to what you previously put in the e-mail template. In this example they are email, tag, problem