Special Edition Using CGI

Written by: Jeffry Dwight and Michael Erwin

with

Tobin Anthony Greg Knauss

Danny Brands Robert Niles

Rod Clark Bill Schongar

Mike Ellsworth Crispen A. Scott

David Geller K. Mitchell Thompson

Galen A. Grimes Matt Wright

Matthew D. Healy

Copyright 1996 by QueTM Corporation.

All rights reserved. Printed in the United States of America. No part of this book may be used or reproduced in any form or by any means, or stored in a database or retrieval system, without prior written permission of the publisher except in the case of brief quotations embodied in critical articles and reviews. Making copies of any part of this book for any purpose other than your own personal use is a violation of United States copyright laws. For information, address Que Corporation, 201 W. 103rd Street, Indianapolis, IN 46290. You may reach Que's direct sales line by calling 1-800-428-5331.

Library of Congress Catalog No.: 95-72594

ISBN: 0-7897-0740-3

This book is sold as is, without warranty of any kind, either express or implied, respecting the contents of this book, including but not limited to implied warranties for the book's quality, performance, merchantability, or fitness for any particular purpose. Neither Que Corporation nor its dealers or distributors shall be liable to the purchaser or any other person or entity with respect to any liability, loss, or damage caused or alleged to be caused directly or indirectly by this book.

98 97 96 4 3 2 1

Interpretation of the printing code: the rightmost double-digit number is the year of the book's printing; the rightmost single-digit number, the number of the book's printing. For example, a printing code of 96-1 shows that the first printing of the book occurred in 1996.

All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Que cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark.

Screen reproductions in this book were created using Collage Plus from Inner Media, Inc., Hollis, NH.

Credits

President

Roland Elgey

Publisher

Joseph B. Wikert

Publishing Director

Brad R. Koch

Editorial Services Director

Elizabeth Keaffaber

Managing Editor

Sandy Doell

Director of Marketing

Lynn E. Zingraf

Title Manager

Jim Minatel

Acquisitions Editor

Cheryl D. Willoughby

Product Directors

Mark Cierzniak

Benjamin Milstead

Production Editor

Susan Shaw Dunn

Editors

Kelli M. Brooks

Thomas Cirtin

Chuck Hutchinson

Anne Owen

Assistant Product Marketing Manager

Kim Margolius

Technical Editors

Kyle Amon

Justin Bell

Eric Iverson

Brian Valente

Operations Coordinator

Patricia J. Brooks

Editorial Assistant

Andrea Duvall

Technical Specialist

Nadeem Muhammed

Software Specialist

Oran Sands

Book Designer

Ruth Harvey

Cover Designer

Dan Armstrong

Composed in Stone Serif and MCPdigital by Que Corporation.

For Valerie Smith, with gratitude and appreciation.

-Jeffry Dwight

To Sidney Thomasson, my mentor and friend, I will miss you...

-Michael Erwin

About the Authors

Jeffry Dwight is the CEO of Greyware Automation Products, a consulting firm specializing in custom applications and Internet-related utilities. He's a confirmed Windows NT bigot, and his firm produces NT software almost exclusively. Since he founded Greyware in 1990, the firm has become an important resource to the NT community. Jeffry is a certified engineer with expertise in dozens of operating systems and programming languages.

Jeffry also writes poetry and fiction, and is active in the science-fiction community. He chaired the Nebula Awards Novel Jury for the Science Fiction Writers of America (SFWA) in 1993 and 1994, and Greyware provides home pages for many SFWA authors-as well as SFWA itself. The Horror Writers Association, several genre magazines, and many other authors all make their homes at Greyware, too.

Jeffry is currently single, has no pets, and lives in Dallas. He enjoys programming and writing fiction, but would much rather give it all up in favor of mucking about with a guitar and a drink someplace cool, quiet, and dark.

Michael Erwin first worked with computers in the mid-'70s. He built his first S-100 bus system in 1979, which combined his interests in electronics and circuitry design. It was based on the relatively new Intel Z-80, running assembler and later CP/M. In 1982, as a junior in Barboursville (W.Va.) High School, he helped develop several computer course curriculums for high school and adult students. In the fall of 1982, he began teaching adult classes at Cabell County Technical Center. During the spring of 1983, he was given the chance to install several local area networks in the local school systems as a pilot project.

He has helped start numerous regional computer-based companies and has designed various systems for the banking, chemical, environmental, manufacturing, and publishing industries. He has worked for Union Carbide, Pioneer Technology, and several branches of the U.S. government. In many of these organizations, he also developed the training and user education services.

A monthly columnist in Boardwatch Magazine, Mike has been a featured speaker at ONE BBSCON, where he has helped numerous others to become Internet service and Web space providers. Mike is also currently works in the IT department of INCO Alloys International Inc. He's also a partner in eve, Inc., an ISP consulting firm, which has also given him the opportunity to publish "The WebMasters Resource" CD-ROM series. You can find Michael on the Web at http://www.eve.net/~mikee or you can e-mail him at mikee@eve.net.

Contributing Authors

Tobin Anthony holds a doctorate in aerospace engineering but has been tinkering with computers for more than 18 years, specializing in the UNIX and MacOS environments. A strict vegetarian, devout Roman Catholic, and lapsed private pilot, he spends what little spare time he has with his wife, Sharon, and three children, Michelle, Austin, and Evan. Tobin works as a spacecraft control systems engineer at NASA's Goddard Space Flight Center in Greenbelt, Maryland. E-mail and Web stops are welcome at tobin@pobox.com and http://pobox.com/~tobin.

Born and raised in the Amsterdam, The Netherlands, Danny Brands has a degree in chemical engineering and became a doctoral student at the University of Amsterdam's Department of Chemical Engineering in 1993. He set up the department's e-mail and Web server and started specializing in Windows CGI programming in Visual Basic. He has been active in several Web server related newsgroups and has done free-lance Windows CGI programming and Web development jobs in his spare time. When he leaves his computer, he is known to play a little on one of his Fender guitars, do some serious skating on one of the frozen Dutch canals, or drink a Bulgarian cabernet sauvignon wine with his girlfriend, Ruth.

Rod Clark lives quietly in Seattle, where he does some contract programming and technical work, and maintains the Small Hours pages on the Web. He's worked as an electronic distribution specialist in the Seattle office of a company that has, so they say, occasionally misled people, and as a network implementation analyst during the startup of a local aircraft manufacturing plant.

Mike Ellsworth is the Development Manager of Advanced Technology and the Webmaster for the A.C. Nielsen Company. He established the corporate Web site and has developed two information delivery services for Nielsen: BrokerNet and SalesNet. While developing these Web services, he did extensive CGI programming, including interfacing with legacy systems. He holds a degree in psychology from Duke University and received writing training at the University of Denver. Mike and his family live in Minnesota, and he enjoys music, movies, basketball, running, and racquetball.

David Geller is the Director of Online Engineering at Starwave Corporation (http://www.starwave.com), the Internet's No. 1 content-based site hosting such popular services as ESPN SportsZone, NBA.COM, Mr. Showbiz, Family Planet, and Outside Online. David is also the author of several popular shareware programs, including SnapCAP (included with this book's CD-ROM), Origo, and WEB Wizard: The Duke of URL.

Galen Grimes lives in a quiet, heavily wooded section of Monroeville, Pennsylvania, a suburb of Pittsburgh, with his wife, Joanne, and an assortment of deer, raccoons, squirrels, opossums, and birds, which are all fed from their backdoor. Galen is the author of several Macmillan Computer Publishing books, including 10-Minute Guide to Netscape, and 10-Minute Guide to the Internet with Windows 95, both published by Que Corporation; First Book of DR DOS 6, published by SAMS; and 10-Minute Guide to NetWare, 10-Minute Guide to Lotus Improv, and Windows 3.1 HyperGuide, all published by Alpha Books. Galen has a master's in Information Science from the University of Pittsburgh, and by trade is a project manager and NetWare LAN administrator for a large international bank and financial institution. You can reach Galen by e-mail at gagrimes@city-net.com or through his home page at http://www.city-net.com/~gagrimes/galen1.html.

Matthew D. Healy does various tasks, from UNIX system administration and database administration to building Web front ends on top of Sybase, mSQL, and Illustra relational databases, at the Center for Medical Informatics, Yale School of Medicine. Before joining the center, he designed electric motor control systems, taught undergraduate biology lab sections, managed an AppleTalk LAN, and read many science-fiction novels. His other interests include skiing, folk music, filk music (science-fiction music that parodies folk songs), and the history of science. Along the way, he has earned a B.S. in engineering from Purdue University and a Ph.D. in zoology from Duke University. His e-mail address is Matthew.Healy@yale.edu; the URL http://paella.med.yale.edu/~healy/matt_healy.html is his home page.

Greg Knauss is a programmer working with Windows and UNIX. He lives in Los Angeles with his wife, Joanne. Previously, he contributed to Que's Using HTML and Special Edition Using Netscape 2.

Robert Niles is an independent consultant who's completely fixated on the Web, and on the Internet as a whole. Robert owns and runs a small business called ITM Services located in Selah, Washington, that provides Internet-related services to those in the surrounding valley. Robert entered military service in 1984, completing an extensive one-year course at the Presidio of Monterey as a Czech linguist. After finishing military service, Robert returned home to Yakima Valley, where he lives with his wife, Kimberly; his son, Michael; and his daughter, Shaela. You can contact Robert at rniles@shaela.itm.com.

Overseeing online support for AimTech Corporation, Bill Schongar is always looking at new integration technologies to make life easier. When not online, he's off wondering how far a catapult can toss a head of lettuce, and other strange medieval thoughts to remove him from the modern world.

An independent hardware and software engineering consultant, Crispen A. Scott lists among his accomplishments such varied projects as the digital anti-skid braking system for the B-2 Stealth Bomber, various Windows drivers and applications, and embedded control systems for the medical and industrial control fields. Crispen is currently developing Web home pages, CGI applications, and establishing Web sites for Chicago-based customers of his Commercial, Residential and Institutional Software Corporation. A graduate of the University of Tennessee, Crispen also lectures, conducts seminars, and presents training reviews nationally. In his spare time, Cris continues to polish his writing skills in poetry and science fiction. Crispen can currently be reached at crisin19@starnetinc.com and, in the near future, at his Web site (search for Chicago Developments).

K. Mitchell Thompson is an independent software developer in Atlanta with more than 12 years of commercial experience. In addition to this book, he has contributed to Using Turbo C++ 4.5 for Windows and Special Edition Using the Internet (first edition), also published by Que Corporation. Mitchell's current professional interests include Java, MPEG, and real-time and distributed systems. Any free time is devoted to his daughter Kate's piano, an Irish wolfhound's exercise, and conversation with his best friend and wife, Kathy. Mitchell can be reached at http://www.crl.com/~ktomsun.

Matt Wright works at Hewlett-Packard, where he writes HTML and CGI programs. In his spare time, he maintains Matt's Script Archive, a Perl/CGI Web page located at http://www.worldwidemart.com/scripts/. Matt also enjoys skiing and fly-fishing with his parents and younger brother. He spent 12 years in Louisiana before moving to his current home in Fort Collins, Colorado.

Acknowledgments

From Jeffry Dwight: This book wouldn't have been possible without the help of Cheryl Willoughby, Ben Milstead, and the rest of the gang at Que Publishing, who lovingly and painstakingly pulled order from chaos and made everything come together correctly. That they did it at all is a miracle; that they do it regularly is beyond comprehension.

From Michael Erwin: First, I would like to thank my wife, Jacqueline, who has been a sweetheart when I have been working on this book. She truly loves me to be able to put up with my running around at Mach 2 with my hair on fire. Second, I would like to thank my mom and dad. I also thank Larry Brammer and Harold McKeand, at eve Inc., for carrying my load during the last few weeks. I would also like to thank Gary Bratton and Suzi Bowen of Inco Alloys International Inc. for supporting me. Special thanks to Joyce Coombs, Mike Digman, and Todd Broucksou of MountainNet, Inc. And last but definitely not least, a big special thanks to the Jack Rickard and David Hakala at Boardwatch Magazine, for supporting me, and to also give me the opportunity to write for the best online magazine.

To everyone at Que: All I can say is wow. I especially would like to thank Cheryl Willoughby, Susan Dunn, Ben Milstead, and Mark Cierzniak for hanging in there and helping me along the way. Without them, you wouldn't be reading this now. Not to mention all the other contributing writers, who make this book the new standard for CGI programming.

We'd Like To Hear from You!

As part of our continuing effort to produce books of the highest possible quality, Que would like to hear your comments. To stay competitive, we really want you, as a computer book reader and user, to let us know what you like or dislike most about this book or other Que products.

You can mail comments, ideas, or suggestions for improving future editions to the address below, or send us a fax at (317) 581-4663. Our staff and authors are available for questions and comments through our Internet site, at http://www.mcp.com/que, and Macmillan Computer Publishing also has a forum on CompuServe (type GO QUEBOOKS at any prompt).

In addition to exploring our forum, please feel free to contact me personally to discuss your opinions of this book: I'm bmilstead@que.mcp.com on the Internet, and 102121,1324 on CompuServe.

Thanks in advance-your comments will help us to continue publishing the best books available on new computer technologies in today's market.

Benjamin Milstead
Product Director
Que Corporation
201 W. 103rd Street
Indianapolis, Indiana 46290
USA

Back to the Table of Contents