cgi concepts


what is cgi?
CGI stands for Common Gateway Interface. It is a common method of creating interactive content. It is slowly being outmoded by newer technologies, although it is still in very widespread use and is worth learning.

what does cgi do?
CGI provides a method for users to interact with the server. Let's take an example. Say you are having a problem with your computer's sound card, and need to call tech support. CGI would be talking to a real person, and the oppisite would be using one of those annoying voice systems. This is phone tech support without the equivalent of CGI:

TS: Hello. You have reached the technical support line.
Press 1 if you are having a problem with your disk drive.
Press 2 if you are having a problem with your monitor.
Press 3 if you are having a problem with your hard drive.
Press 4 if you are having a problem with your sound card.
Press 5 if you are having a problem with your speakers.
Press 6 if you have impaled your computer on a large spike due to frustration.
Press 7 if you are experiencing a different problem.

You: 4

TS: You have chosen the sound card section.
Press 1 if you are not hearing any sound.
Press 2 if your volume is too low.
Press 3 if your sound card constantly repeats "007".

You: 1

TS: You have chosen 1: you are not hearing any sound.
Make sure your speakers are turned on.
Thank you for calling technical support.
You have been charged $4.99 per minute. Goodbye!

You: !censored!

Now, here is what happen in tech support with the equivalent of CGI:

TS: Hi there, how can I help you today?

You: Hi, I'm not getting any sound from my sound card.

TS: Okaaaay... are your speakers turned on?

You: Yes, of course. I'm not that dumb!

TS: Okay! Just making sure. Are they plugged in correctly?

You: Oh gee! Okay, I am dumb! Thanks a lot!

TS: Nooooo problem! Thanks for calling!

As you can see, the latter method is far superior to the former. The latter is interactive, whereas the former is not.

Take the search function on the sidebar of this site. If CGI did not exist, the best that we could do would be to provide a keyword index page. You would click on an "index" link, and then your browser would receive the index from the server. You would then have to hunt for what you are looking for in this index. This is not interactive, because you have to choose from all the keywords the server has to offer, not just the ones you want.

But, fortunately, CGI does exist, so you can type what you want to find in the text box. When you press the "Go" button, your browser sends the terms you typed in the text box to the server. The server then performs the request: it looks through all the pages in the site for the terms you specified, and only sends back links to the ones where the terms were found. This way, all you see is the sites that have what you want, instead of everything at once.

CGI can do much more than just search functions. If you have ever purchased merchandise over the Internet, you probably filled out a form where you entered your name, address, and credit card number. When you Submitted this form, your browser sent the information you typed in to the server, and the server then performs a CGI function that its webmaster has programmed (in this case, it enters the order and charges the credit card).

If CGI did not exist, all the server could do would be to tell you to call their sales people, so you could then tell them what you wanted.


Click here to go back to the table of contents.


Copyright © 1998 Webworks Team. All rights reserved. Email with questions or comments about this web site.