Skip to content
Thoughtful, detailed coverage of everything Apple for 34 years
and the TidBITS Content Network for Apple professionals

The Plug-and-Play Web Site, Part 2

Last week in NetBITS-010 we looked at how you can add functionality to your Web site by using a service; this week we’ll turn our attention to CGI (Common Gateway Interface) programs, which are often simple little applications or scripts that run on the Web server, and process information submitted from forms in your Web page.


There are hundreds of CGIs available; many are free, many others are low cost. In many cases you can install these programs for yourself. However, installing CGIs can become confusing for those without a single geek gene – but that’s okay, because you can often find someone to install a script for you at a very low cost. Someone who knows how to work with CGIs can usually install one very quickly, so you may have to pay as little as $25 or $50 to get a simple script installed in some cases.

Do note that CGIs are somewhat specific to the Web server software used for your Web site. So, if your Web site is running under Apache, the popular free Unix Web server, you can’t install a CGI designed to work with WebSTAR on the Mac OS. Within an operating system, most CGIs will work – so a CGI for WebSTAR should work with another Mac OS Web server such as NetPresenz, for instance – but it’s not guaranteed.

Where can you find CGIs, and what can they do? There are scores of great CGI sites scattered around, though Selena Sol’s Public Domain CGI Script Library, Matt’s Script Archive, and The CGI Collection are particularly good:




If you’d like to see a list of more CGI libraries, visit my links page, click the Chapter 12 link, then click the Finding CGI Scripts link that appears. This is a very large list (almost 800 links) so it may take a while to load.


CGI scripts can be used to do all sorts of wonderful things, including the following:

  • Send information submitted from a form to a specified email address.

  • Copy information from a form and save it in a text file. (I give you one of these scripts below.)

  • Create a guest book or a classified ads page. (They’re similar; in both cases information provided by a visitor is displayed in one of your Web pages.)

  • Search your Web pages.

  • Verify a credit card number has been entered correctly.

  • Display text (such as a quote) or an image (such as an advertising banner) selected at random.

  • Add a visitor’s name and email address to a mailing list.

  • Create a shopping cart and order-taking system.

This is a small list; there are hundreds of great scripts available – many for little or nothing.

Form to File Script — Here’s a simple little script you can download from my Web site that takes the contents of a form and saves it in a text file. To find information about it and download a copy, go to my examples page again and look for the link that says "A simple and effective ‘Free Giveaway’ promotion."


You can copy this script to your Web server and use it for whatever purpose you want. For instance, you might encourage people to sign up for an announcement list so you can let them know when you change something at your site or when your company releases a new product. Of course, the question is, "do they really care?" People will only sign up if you provide them with something they want or need.

This script is truly simple. I took a sample script that my Web-hosting company had created, then modified it to suit my purposes. Will you be able to install it? If you have permission to set up scripts at your Web server, and if you’re just a tiny bit geeky, you should be able to follow the instructions and get it running. On the other hand, if you’re the sort of person who hates fooling with computers, and regards them as a necessary evil, you may need to get someone to help you set up the script.

I use this script in giveaways. For instance, I’m giving away free copies of my latest book; visitors to my site fill in the form to win a free copy of the book.


The form contains two text boxes, one for the name and one for the email address. It also has two option buttons that allow the visitor to choose whether to receive my newsletter. When the visitor clicks the submit button the script takes the information and saves it in a comma-delimited text file, something like this:

"John Smith","[email protected]","Yes"

The "Yes" at the end shows the status of the options buttons; if the visitor chose the Yes button, it says "Yes", if the visitor chose the No button, it says "No".

The "comma-delimited" format is a standard format for database import. In short, you can import this file directly into a database program or spreadsheet, where you can sort out the entries with Yes into a separate list, from which you can create a mailing list.

The AOL Problem Again — To run a CGI, you need access to the Web server; you must install the script and set it up so that it will run when "called" from a Web page. If you are using a personal pages Web site, though, you can’t do that; these sites are designed for plain HTML pages, and they don’t want people running scripts.

You can circumvent the problem, though, by running the script on someone else’s server. This is the great thing about the Web: a link can connect to or run any other page or script anywhere else on the Web. In the same way that you can create a link from a Web page to another page on a completely different server, you can set up forms to run scripts on other servers. Now we’re back to my first "plug-and-play" method, or at least a combination of the two methods – you can find a service to run the CGI for you, or you can find the CGI and install it yourself at a friend’s Web site that doesn’t have restrictions on CGIs. For instance, there’s a free service called CGI Free that allows you to link to a number of scripts they provide, listed below.


  • FormMailer: Perhaps the most useful, this script mails the contents of a form to the address you specify.

  • Browser Redirection: Checks to see which browser a visitor is using, then displays the appropriate page.

  • Random Image: Displays an image, selected at random from a list you provide.

  • Clock: Displays a clock on your Web page.

  • Random Link: A link that takes the visitor to a randomly selected Web page.

  • CountDown to Date: Counts down to a date and time you specify.

  • Menu Direction: Creates a menu from which the visitor can select a destination Web page.

Finding CGI Help — If there’s no way that you can install a CGI script for yourself (and unfortunately they can get complicated), where do you turn? First, ask your Web hosting company how much they charge to install things. If they can’t do it, or are going to charge too much, try Selena Sol’s Help for Hire page. Selena is well-known in the CGI world; she has a great library of scripts that she created, along with a page that lists CGI consultants.

< found.html>

Some CGI shareware companies sell utilities and include installation, or charge $50 or so for installation. Look around and you’ll find plenty of people willing to install your scripts.

CGI-like Systems — CGIs are not the only way to add interactivity to your Web site. There are a variety of other scripting languages, such as Aestiva HTML/OS, PHP/FI, Un-CGI, and, to some degree, JavaScript. CGIs have several advantages, though. There are script libraries containing hundreds of great programs; fewer are available for these other systems. And CGI scripts are more likely to be able to run on your Web server.

There is one other important system that I should mention, Microsoft FrontPage server extensions. Many Web hosting companies have installed these server extensions, which work in conjunction with FrontPage, Microsoft’s Web authoring program.

< unixinstall.htm>

For instance, a FrontPage user can create a Web-based discussion group in about ten minutes by using a wizard that’s built into the program. The discussion group works properly – visitors can read messages and post replies to other messages – as long as the Web site runs on a server that has the FrontPage server extensions installed.

FrontPage can save you a great deal of time – it can create forms that mail messages to you, save form submissions in a text file, set up private areas of your Web site, automatically change an image or block of text at a specific time or date, and so on. Unfortunately, the Macintosh version of FrontPage is currently behind the Windows version and lacks some of the neat tools. Still, it’s a good program for creating low-cost Web sites. Is it the best tool? That depends on your situation. If you run your own server, perhaps not. However, if, like hundreds of thousands of others, you serve your Web site via a Web hosting company, then FrontPage is hard to beat if the hosting company has installed the server extensions. There are currently almost 500 such companies. In essence, FrontPage provides a way to add interactivity to your site – all this CGI stuff – without having to install CGIs.

Web Sites Made Cheap and Easy — I’ve barely scratched the surface with this look at the plug-and-play Web site. There are all sorts of great things you can do at your Web site with minimal cost and little effort. It’s just a matter of a little research. If you decide you need to add something to your Web site, do some digging around in the search sites, in the CGI libraries mentioned above, and in my links page. You may be surprised at what you find. Just remember, Web sites that work for you don’t have to be expensive!

[Peter Kent is the author of "Poor Richard’s Web Site: Geek-Free, Commonsense Advice on Building a Low-Cost Web Site." Win a free copy at the Web page below.]


Subscribe today so you don’t miss any TidBITS articles!

Every week you’ll get tech tips, in-depth reviews, and insightful news analysis for discerning Apple users. For over 33 years, we’ve published professional, member-supported tech journalism that makes you smarter.

Registration confirmation will be emailed to you.

This site is protected by reCAPTCHA. The Google Privacy Policy and Terms of Service apply.