# Simple Form Support v. 2.5

16 Nov. 94

Author: Mark Bracewell
mcb@wgg.com

Simple Form Support is a form handling script for Win HTTPD.
(requires vbrun300.dll)

It will handle forms in the following ways:

It will write (in html) to a file for storing form data, each entry is separated with

(<HR>), and you get to specify the filename, so it can be a private log file like `c:\temp\submit.dat`, or a public file like `/htdocs/usertalk.htm.`

Note: the file to which data is written must exist prior to running the script. If it does not exist, it will not be created and the script will return a 'file not found' error. Minimally, the file must include
<!--footer-->
on a line by itself.

Then it sends the client a confirmation of the submission or to any URL you specify.

Each form can have it's own section in the cgi_form.ini file so the "log" file and URL the client is sent to can be tailored to each form. The .ini file also allows you to specify whether to archive extra header information (the remote address of the client, type of browser, etc.) and whether to send the client to a new page or simply return a confirmation of the submission.

INSTALL

The executable, form2htm.exe, goes in your cgi-win dir.

cgi_form.ini goes in your windows directory.

Forms access cgi_form.exe this way:

    <FORM METHOD="POST" ACTION="http://YOUR.DOMAIN/cgi-win/form2htm.exe/SECTION">

where 'SECTION' is the name of the section in cgi_form.ini that corresponds to that specific form.

The above example would look for [SECTION] as the configuration file for that form. here's what the .ini file looks like:

    [SECTION]
    ;the file you want the form data appended to, don't forget the quotes
    Archive="c:\temp\formsubm.htm"

    ;where you want the client to be sent after they submit the form
    SendURL=/demo/

    ;add extra header info to archive file? (what you get depends on the browser)
    ExtraHeaders=yes    (or 'Yes', anything else is the same as 'no')

    ;send only a confirmation of the submission?
    Confirm=no    ('no' will send them to SendURL, 'yes' will send only a confirmation)

    [AnotherSECTION]
    Archive="c:\temp\data.txt"
    SendURL=/demo/
    ExtraHeaders=no
    Confirm=yes

Notes:

- If you run form2htm.exe directly from file manager or progman, there is a brief reminder of the syntax for the form and .ini file.
- Notice the quotes surrounding the path and file info following 'Archive='
- If you make the Archive file and the SendURL the same, users can see their own input as well as that of others, something like a news group.
- If someone tampers with the form and leaves the selector off the end of the form tag, they get sent to a random URL (try this, it can find some interesting sites :)...)
- The Archive file may have a Header and Footer, the Header is simply whatever you place at the beginning of the file. The Footer, which will be re-written at the end of the file with each submission is anything following the tag <!--footer--> (which must be on a line of its own). Submissions will be inserted immediately above it.
- Another executable, form2txt.exe, is included for those instances where it is better to archive the data in a text file. It behaves in the same way as form2htm.exe, uses the same .ini file but has these differences:
  it writes plain text
  it does not support the use of a footer
  it does not require the <!--footer--> tag

Revision History:

1.0 initial release only archived the data and sent a confirmation.

2.0 added .ini file configuration (each form had an .ini file) and the option to send the client to a URL or a confirmation. Executable renamed cgi_form.exe (was comment.exe)

2.1 changed to one ,ini file with multiple sections

2.2 added footer capability and tidied up the docs

2.5 added plain text executable, changed names again