The Mechanics of CGI

The user clicks on a link (or the submit button of a form)

The web browser sends a HTTP request, including the URL of the selected link

In the context of form submission, the data is tranferred either through the URL or during the communication exchange

http://127.0.0.1/cgi-bin/form.pl

http://allforms.mailjol.net/

The web server determines that the request should be handled by running a CGI program.
Often restricted to a particular directory (cgi-bin) or have a cgi, pl, or asp suffix

The CGI program may be written in any language. Perl (.pl) used to be popular because it is good for manipulating text

For more on cgi script : http://cgi.resourceindex.com/