C.1 What Is CGI?

Thoughout this book everything has happened in the browser because we have been talking about client-side JavaScript. When we discussed HTML forms, we learned how to create a form and validate it, but we stopped there. We mentioned that the form, if submitted, would be sent to a server program for further processing, normally by a CGI script. This server program was assigned to the ACTION attribute of the HTML <form> tag, but we never really covered what happened on the server side. Now we will discuss how the browser communicates with the server, how the information is sent between the browser and server, and what the happens to information when it gets to the server. The standard we will use on the server side is called CGI.

CGI stands for the Common Gateway Interface (CGI), a simple protocol that allows a Web or HTTP server to talk to a program or script. Through this gateway a program recieves information from the server and sends information back. The program can further validate forms, query databases, send email, communicate with electronic banking applications, etc. The programming language that is connected to the gateway is called a CGI program. In this Appendix we will use the Perl language because it is the most popular for writing CGI scripts, although any programming language that can be executed on the server is fine, including C++, C, Fortran, AppleScript, TCL, and Visual Basic.

Figure C.1. The relationship between the browser, server, and CGI program.


JavaScript by Example
JavaScript by Example (2nd Edition)
ISBN: 0137054890
EAN: 2147483647
Year: 2003
Pages: 150
Authors: Ellie Quigley

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net