1.1.3 CGI Script Executes

When the CGI script executes, it examines the HTTP request. In our example, the HTTP request indicates that ``CGI'' is in the textbox for entering the search keyword, and that the search button was pressed.

A CGI script is a program, no more and no less. It can specify any logic a ``conventional'' program can. In our example, the CGI script uses ``CGI'' as a keyword and search for it in a database that catalogs all the merchandise sold by Borders.

As a CGI script receives data from a database, the script needs to process that data, and somehow transform the raw data into HTML elements (such as tables, buttons, bitmaps and etc.). A CGI script sequentially outputs (prints) the HTML elements so that the output eventually becomes an HTML document.



Copyright © 2008-05-09 by Tak Auyeung