Common Gateway Interface (CGI)
CGI
stands for Common Gateway Interface, a method for running programs on the Web
server based on input from a Web browser. CGI scripts enable your readers to
interact with your Web pages-to search for an item in a database ,to offer
comments on what you've written, or to select several items from a form and get
a customized reply in return. If you've ever come across a fill in form or a
search dialog on the Web, you've used a CGI script.
You
may not have realized it at the time because most of the work happens on the Web
server, behind the scenes. You see only the result. As a Web author, you create
all the sides of the CGI script: the side the readers see, the programming on
the server side to deal with the readers' input, and the results given back to
the readers. A CGl script is an extremely powerful feature of Web browser and
server interaction that can completely change how you think of a Web
presentation.
We will discuss following about CGI scripts, including the
following:
·
What
a CGI script is and how it works
·
What
the output of a CGI script looks like
·
How
to create CGI scripts with and without arguments
·
How
to create scripts that return special responses
·
How
to create scripts to process input from forms
·
Troubleshooting
problems with your CGI script so CGI variables you can use in your
scripts
·
Scripts
with non-parsed headers
·
Searches
using <ISINDEX>
We
focus primarily on Web servers running on UNIX systems, and most of the examples
and instructions will apply only to UNIX. If you run your Web server on a system
other than UNIX, the procedures you'll learn in this section for creating CGI
scripts may not apply. This chapter will at least give you an idea of how CGI
works, and you can combine this information with the documentation of CGI on
your specific server.