Gform 1.0a for Windows

Gform 1.0 is copyright 1994 by Joey Hess. It is a modification of gform for Unix by Harry Raaymakers.

Gform is freeware - you are free to use this program and give it to others, provided you do not modify the program in any way. You may modify the program for your personal use.

The problem with forms is that they all need their own program to handle the fields in the form. Most often you want to collect submitted forms in a file or send it through the mail. The creation of individual form programs can be a pain.

Gform is designed to make creating forms handling program simple.

How it works

In your HTML form you specify the FORM 'ACTION' to be 'gform', and as parameter you pass it the pathname of the form.

In the HTML tag set there is a tag for comment <! .. >. What gform does is read comments that start with <!gform ....>. These special comments contain commands for gform. Any number of these <!gform ..> comments maybe used.

Syntax of gform commands

There are 2 types of <!gform ...> commands.

Note that after a deliver command saves something to a file, it erases it from memory. You can have several deliver commands in a single form, and each can save different lines of text to a file. Here is an example.


Variables start with a '$' sign followed by the variable name as specified on the HTML INPUT tag in the HTML file. They are are terminated with a '$' sign. The varables you use must be specified in the INPUT tags. You do not have to use all the variables.

Variables can be used in any gform command inside quote characters, ie. in a text string or in a reply or deliver filename.

There are several special variables that are built into gform.

Complete example

Take the form file below and notice the <!gform> comments There are several variables given by the INPUT tags. They are then addressed as $id$, $pin$, $field3$ etc. in the <!gform> commands.

In particular note how parameters are passed to a program from a HTML file ( ie. the line

"<FORM method=POST action="/cgi-win/gform.exe?/pub/htm/feedback.html">"
has /pub/htm/feedback/htm as the parameter to gform which should be the pathname of the current form.)


<FORM METHOD="POST" ACTION="/cgi-win/gform.exe?/pub/htm/feedback.html">
From:<INPUT TYPE="text" NAME="from">
Subject:<INPUT TYPE="text" NAME="subject"><P>
To submit your message, press this button: 
<INPUT TYPE="submit"VALUE="Submit Comments"><P>
To clear the form, press this button: 
<INPUT TYPE="reset"VALUE="Clear Form">

<!gform "----------------------------------$n$">
<!gform "Date: $date$">
<!gform "From: $from$$n$">
<!gform "Subject: $subject$$n$">
<!gform "Message Body:$n$$message$$n$">
<!gform deliver append="c:\feedback\wwwmsg.txt">

<!gform "{title}Thanks for Your Feedback!{/title}$n$">
<!gform "{h1}Thanks for Your Feedback!{/h1}$n$">
<!gform "Your message has been processed and saved,$from$$n$">
<!gform "I'll read it and get back to you as soon as possible.{P}$n$">
<!gform "{HR}{I}This form was processed by GFORM by Joey Hess.{/I}{P}">
<!gform deliver file="c:\pub\htm\gform\thanks.html">

<!gform reply="/gform/thanks.html">


Notice that the above file uses two deliver commands. The first appends the message created by the series of text strings to "c:\wwwmsg.txt", for later reading. Then that message is erased, so a new one can be built up, to thank the user for sending feedback. Notice also that this message is customized with the user's name ($from$). This message is written to the file "c:\pub\htm\tmp\thanks.html".

The reply command causes the file "c:\pub\htm\tmp\thanks.html" to be sent to the user's browser. Alternatively, you could write a stock reply file that the form always replies with. This would be faster than creating one on the fly, but a personal touch is nice.


When you put things up on the web, it's improtant to be security conscious. Be warned that if gform is set up incorrectly, it has the potential to be a security hazard on your computer.

To address this problem, gform comes with a file, security.dat, which contains information about what parts of your computer gform is allowed to write to.

The file is just a list of directories, where each directory on the list is one where gform is allowed to deliver files. See installing gform for information and advice about setting up the proper subdirectories.

If it is set up properly, gform will not allow users to read or write unauthorized files to your computer.

Installing gform

To install gform, you will need to have already installed a web server program that supports the CGI MS Windows Interface version 1.1. HTTPD for windows supports this interface, there may be others. I have placed information appropriate to HTTPD in brackets to make things easier for HTTPD users.