Let's unlock a little bit of
mystery about something called CGI. If it helps any, CGI means Common Gateway Interface. This is a method which is used to exchange data between
server (the hardware and software that actually allows you to get to your web site) and a web client (your browser). CGI is actually a set of standards where a program or script (a series of commands) can send data back to
web server where it can be processed.Typically, you use standard HTML tags to get data from a person, then pass that data to a CGI routine. The CGI routine then performs some action with
data.
Some of
more common uses of CGI include:
- Guestbooks - The CGI routine is responsible for accepting
data, ensuring it is valid, sending an email acknowledgement back to
writer, perhaps sending an email to
webmaster, and creating
guestbook entry itself.
- Email Forms - A simple CGI forms routine just formats
data into an email and sends it back to
webmaster. More complicated routines can maintain a database, send an acknowledgement and validate data.
- Mailing List Maintenance - These routines allow visitors to subscribe and unsubscribe from a mailing list. In this case,
CGI routine maintains a database of email addresses, and
better ones send acknowledgements back to
visitor and webmaster.
A CGI routine can be anything which understands
CGI standard. A popular CGI language is called PERL, which is simple to understand and use (well, compared to other languages). PERL is a scripting language, which means each time a PERL routine is executed
web server must examine
PERL commands to determine what to do. In contrast, a compiled language such as C++ or Visual Basic can be directly executed, which is faster and more efficient.
Okay, in a nutshell (and greatly simplified), here's how it works:
1) You (the webmaster) specify a form tag which includes
name of
CGI routine.
2) You create HTML tags which retrieves data from your visitors.