The Genesee Gateway

The Genesee Gateway's
Support Center


GGW is working on setting up a library of ready-to-use CGI applications to help you extend your web site.  For now, here is documentation on our popular GFH utility.


GFH is a simple CGI (Common Gateway Interface) application that lets you collect information from users and email that information to an address you specify. GFH has another function too; it can be used as a redirector, allowing you to let the user jump to any URL you specify as part of a form. Volunteers and organizations who place information on The Genesee Gateway are free to use GFH.

GFH requires the use of HTML forms. Examples of how to create forms for GFH are given in this document, but are not a substitute for learning about forms from other sources. In addition to resources on the World Wide Web that describe how forms work, there is a glut of HTML books available at libraries and bookstores that describe forms.

Using GFH

The URL for GFH is http://www.ggw.org/cgi-bin/gfh.pl .

You must transmit data to GFH using the POST method. Following is an example skeleton that shows the most typical way to call GFH:

<form action="http://www.ggw.org/cgi-bin/gfh.pl" method="POST">
     {form content}
</form>

GFH-Specific Form Fields

GFH expects form fields with specific names to direct how it works.  You build these form fields into your forms, and then call GFH. These special form fields are typically intended to be hidden-that is, they aren't shown to the user. The following table shows the various GFH form field names and what they do.

Field Name Description  
gfhRedirect If this form field exists, it means GFH is being used in redirector mode. In this mode, GFH doesn't generate email messages, it only acts as a redirector.  GFH will redirect the user to the URL specified. This allows using selection lists as a means to select URL's as well as other tricks.

Note that URL's specified by these four fields must be absolute, not relative.   In other words, you should specify the full path to the URL.

gfhSuccess URL of a page returned when the form was processed successfully. If not present, a generic message is issued with a link back to the referring page, if known.
gfhRequired URL of a page returned when all required form fields have not been filled in. If not set, a generic message is issued telling the user to go back and fill in required fields.
gfhFailure URL of a page returned when the form could not be processed for some internal reason. If not set, a generic message is issued.
gfhSendAddress Internet email address to mail form contents to.  May be a comma-separated list for multiple recipients.  This field is required unless GFH is being used in redirector mode.  
gfhSendSubject Subject line used on e-mail generated by GFH.  
gfhFormName Names the form (printed in the body of the message).  

Making Required Fields

Required fields are those fields that require something in them. GFH isn't sentient, and so can't tell when nonsense has been entered in a field. GFH can only tell is something (or nothing) is in a field.

To tag a field so it is a required field, follow the field name with an underscore. For example, here is a text field that must be filled in:

<input type="text" name="LastName_">
<input type="text" name="FirstName">

In this example the field named "LastName_" must have something entered or GFH will report an error. The second field in the above example named "FirstName" doesn't end with an underscore, so GFH will allow it to be left blank.

Example: Simple Form

<form action="http://www.ggw.org/cgi-bin/gfh.pl" method="POST">
<pre>
Your full name: <input type="text" name="FullName_"><br>
Your email address: <input type="text" name="Email"><br>
</pre>

<input type="submit">
<input type="reset">
<input type="hidden" name="gfhSuccess" value="yeah.html">
<input type="hidden" name="gfhSendAddress" value="cy@b.org">
<input type="hidden" name="gfhSendSubject" value="Contact Info">

<input type="hidden" name="gfhFormName" value="Test Form">
</form>

Here's an example of an email message that might be generated from the above. The order of fields listed is the order they appear in the form. Note also the trailing underscore on the required field is removed from the email message.

Results of form Test Form:

FullName_       = Anna Rexia
Email           = arexia@ggw.org
--------------------------------------------------------

(Referring page was http://www..ggw.org/faq/account.htm)

Please report problems NOT to the address in the header,
but to webmaster@ggw.org..  Thanks!

Example: Redirector

Here's an example of GFH used as a redirector. A form is presented with a list box that has the names of other pages with their URL's encoded in it. The user can pick one of the pages and hit the "submit" button. GFH will then whisk the user to that page.

<form action="http://www.ggw.org/cgi-bin/gfh.pl" method="POST">
<select name="gfhRedirect">
<option value="http://www.ggw.org/site/index.html">Top Page
<option value="http://www.ggw.org/site/rules.html">Rules Page
<option value="http://www.ggw.org/site/other.html">A Different Page
<option value="http://search.yahoo.com">Yahoo!
</select>
<input type="submit">
</form>