Normal 'fill-out' forms can be emulated in HTML. It is simple to do and easy
Forms can contain input boxes, lists, radio buttons etc.
However, HTML forms are useless on their own...
Common Gateway Interface
CGI is the language between HTML files and applications.
These applications can be writen in any language and on any platform, however
they are simplest to write in PERL in Unix (woops, Linux).
Basically it is a standard for passing information. This information includes
fields from an HTML form and server / client information (user, client address
As with all HTML, a form is a container.
<FORM METHOD=GET ACTION="/cgi-bin/luv/email.cgi">
some stuff in the middle...
METHOD must bet GET or POST. GET uses the environmenent variable QUERY_STRING
to retun information to your application, while POST retuns STDIN (standard
ENCTYPE specified encoding. This attribute only applies if METHOD is set to
POST but at this stage can only be application/x-www-form-urlencoded).
The input structure is the most important and the most used. It is the basic
method of getting information.
Basic structure = <INPUT TYPE=? NAME=? VALUE=? CHECKED=? SIZE=? MAXLENGTH=?>
- text - Normal Text Field
- password - Password entry, characters replaced with *
- checkbox - A single toggle button
- radio - One of many. Linked by name, defined by value
- submit - Submit the form to the application (CGI)
- reset - RESET contents of form
- Name - Used to identify the field in your application
- Value - You can define the default value in the application
- Checked - If type is radio/checkbox you can specify if it is checked.
- Size - Physical size on screen
- Maxlength - Maximum length of a string
Used to create a list or menu
<SELECT name="my list">
<TEXTAREA NAME="foo" ROWS=4 COLS=40>
Default contents go here.
What happens next
The information is then gathered and sent to your application. The method we are
going to concentrate on is GET. POST uses STDIN which means you can not create
an ANCHOR/Link with parameters.
For example, here
is a link to a directory script about me.
This was used to call the above script.
As you can see there is a ? at the end of the URL. Following this is a string
which is passed to the application via the environment variable QUERY_STRING.
It is then up to your application to remove the information and use it.
What happens next on your viewer
All OUTPUT from your script is captured by the HTTP Server and returned to