HTML 3.2 and CGI

Professional Reference Edition

UNLEASHED

by John December and Mark Ginsburg


C  O  N  T  E  N  T  S




PART I  Introduction to Web Systems and Applications

Chapter 1  The World Wide Web as a Communications System

Chapter 2  A Developer's Tour of the Web

Chapter 3  Options for Web Connections

PART II  Web-Development Processes

Chapter 4  Web Development Principles and Methodology Overview

Chapter 5  Web Planning

Chapter 6  Web Analysis

Chapter 7  Web Design

Chapter 8  Web Implementation

Chapter 9  Web Promotion

Chapter 10  Web Innovation

PART III  Web Implementation and Tools

Chapter 11  Design and Implementation Style and Techniques

Chapter 12  Basic HTML 3.2

Chapter 13  Advanced HTML 3.2

Chapter 14  Forms, Tables, and Frames

Chapter 15  Multimedia

Chapter 16  Imagemaps

Chapter 17  Implementation Tools

Chapter 18  Development and Language Environments

PART IV  Gateway Programming

Chapter 19  Principles of Gateway Programming

Chapter 20  Gateway Programming Fundamentals

Chapter 21  Gateway Programming I: Programming Libraries and Databases

Chapter 22  Gateway Programming II: Text Search and Retrieval Tools

Chapter 23  Client-Side Scripting

Chapter 24  Scripting for the Unknown: The Control of Chaos

Chapter 25  Transaction Security and Security Administration

Chapter 26  Gateway Programming Language Options and a Server Modification Case Study

Chapter 27  Creating and Managing Dynamic Web Sites: Differentiating Data from Display

PART V  Case Studies

Chapter 28  Virtual Reality Modeling Language

Chapter 29  C-Based Gateway Scripting

Chapter 30  Writing CGI Scripts in REXX

Chapter 31  A Web Coloring Book

Chapter 32  A Campus-Wide Information System

Chapter 33  A Hypertext News Interface

Chapter 34  A Graphical Web Page Counter

PART VI  Appendixes

Appendix A  Sources of Further Information

Appendix B  HTML Language Reference

Appendix C  Environment Calls

Appendix D  HTTPD Status Codes

Appendix E  Colors by Names

Appendix F  MIME Types and File Formats

Appendix G  Cross-Browser Comparison of HTML

Appendix H  JavaScript Language Reference

Appendix I  Java Language Reference

Appendix J  ActiveX and VBScript Language Reference

Appendix K  Perl 5 Reference

Appendix L  What's on the CD-ROM


Credits


Copyright © 1996 by Sams.net Publishing

Professional Reference Edition

All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. For information, address Sams Publishing, 201 W. 103rd St., Indianapolis, IN 46290.

International Standard Book Number: 1-57521-177-7

HTML conversion by :
    M/s. LeafWriters (India) Pvt. Ltd.
    Website : http://leaf.stpn.soft.net
    e-mail : leafwriters@leaf.stpn.soft.net

Trademarks

All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing 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.


President, Sams Publishing: Richard K. Swadley
Publishing Manager: Mark Taber
Managing Editor: Cindy Morrow
Director of Marketing: John Pierce
Assistant Marketing Mangers: Kristina Perry, Rachel Wolfe


Acquisitions Editor Mark Taber Development Editor Fran Hatton
Software Development Specialist Bob Correll Production Editor Fran Blauw
IndexersCheryl Dietsch, Craig Small, Tim Taylor, Chris Wilcox Technical Reviewers Pam Sheppard, Michael Stangel
Editorial Coordinator Bill Whitmer Technical Edit Coordinator Lorraine Schaffer
Resource Coordinator Deborah Frisby Editorial Assistants Carol Akerman, Andi Richter, Rhonda Tinch-Mize
Director of Production and Manufacturing Jeff Valler Cover DesignerTim Amrhein
Book Designer Gary AdairCopy Writer Peter Fuller
Production Team Supervisor Brad Chinn
ProductionGeorgiana Briggs, Bruce Clingaman, Sonja Hart, Louisa Klucznik


Acknowledgments

I'd like to thank all the readers of the first edition of this book. Without your support, helpful comments, and questions, this second edition would not be possible. I thank all the readers who continue to use this book as their reference for Web development.

Thanks very much to all the contributors to this book. Mark Ginsburg has written an outstanding guide to gateway programming for Part IV, and the contributors of Part V have provided insightful and very useful case studies.

I'd like to thank the great team at Sams.net that has made this book possible. Thanks to Mark Taber and George Bond for giving us the chance to work on this book and all the people who have worked so hard to make this book a reality.

All the people whose applications we've examined or mentioned in this book took the time to answer questions. They also continue to dedicate themselves to creating valuable resources for the Web community as a whole.

I'd like to thank everyone in the Net community whose work gives me insights into what the Net and Web can be. I thank everyone working on Computer-Mediated Communication Magazine for their creative work that continues to help me learn about Web development. Thanks again for the continued patience of my dissertation committee, Robert Krull, Teresa Harrison, Timothy Stephen, and Edwin Rogers at Rensselaer Polytechnic Institute.

-John December

I would like to thank the New York University EDGAR Programming Team-in particular, Oleg Kostko, Alex Bayevskiy, and Aleksey Shaposhnikov for their programming assistance. I also want to express gratitude to the National Science Foundation for funding the NYU EDGAR Project; this proved to be a great breeding ground for Web development. Finally, I want to compliment the World Wide Web Consortium for the great job they do in promoting the open exchange of ideas, both in their Web pages and in their annual W3 conferences.

- Mark Ginsburg

About the Authors

Lead Authors

John December (john@december.com, http://www.december.com/) is a candidate in the Ph.D. program in Communication and Rhetoric at Rensselaer Polytechnic Institute in Troy, New York. Coauthor of The World Wide Web Unleashed (Sams.net) and author of Presenting Java (Sams.net), he also has written for magazines, journals, and books about the World Wide Web, Internet, and computer-mediated communication. He's widely known for his Web-based resource lists about the Internet and as publisher of Computer-Mediated Communication Magazine. Prior to studying at Rensselaer, John earned an M.S. in Computer Science from the University of Wisconsin-Milwaukee, an M.F.A. in Creative Writing (Poetry) from The Wichita State University, and a B.S. in Mathematics from Michigan Technological University. (Part I, "Introduction to Web Systems and Applications," Part II, "Web-Development Processes," Part III, "Web Implementation and Tools," the Introduction, and the appendixes)

Mark Ginsburg (mark@edgar.stern.nyu.edu, http://edgar.stern.nyu.edu/people/mark.html) is a doctoral student in the Information Systems Department, Stern School of Business, New York University. He has a B.A. from Princeton University and an M.A. from Columbia University and was a Stern Scholar in the Statistics and Operations Research Department while earning an M.B.A. at NYU. He is responsible for the daily operation of NYU's EDGAR Web server and is interested in a number of Internet issues, including evolution of standards, collaborative software, and the economics of interoperability. He also is interested in network approaches to clearance and settlement of financial instruments. (Part IV, "Gateway Programming")

Contributors

Kelly Black (black@vidalia.unh.edu, http://www.math.unh.edu/~black) is an assistant professor of mathematics at the University of New Hampshire. His primary interest is numerical modeling of fluid flow. One of his pastimes is applying the graphical tools used in his work to Web page design. (Chapter 34, "A Graphical Web Page Counter")

Dr. Les Cottrell (cottrell@slac.stanford.edu, http://www.slac.stanford.edu/~cottrell/cottrell.html) is the assistant director of the Computing Services group at the Stanford Linear Accelerator Center (SLAC) in California. He is responsible for networking and network services (including WWW). His current projects include developing network monitoring tools and procedures, and he also chairs the ESnet Network Monitoring Task Force. (Chapter 30, "Writing CGI Scripts in REXX")

Daniel J. Murphy, Ph.D. (murphy@sunyit.edu, http://www.arsc.sunyit.edu/~murphy/) earned his Ph.D. from Rensselaer Polytechnic Institute and is an assistant professor of technical communication at the State University of New York (SUNY) Institute of Technology at Utica-Rome, New York. He is a principal member of the CMS Group, LLC, a full-service Internet consulting firm. David A. Coker, Ph.D. is an assistant professor of mathematics and physics at the SUNY Institute of Technology and focuses on software development for the CMS Group. Steven M. Schneider, strategic policy analyst for the CMS Group, is a Ph.D. candidate in political science at the Massachusetts Institute of Technology. He currently teaches political science at the SUNY Institute of Technology. (Chapter 27, "Creating and Managing Dynamic Web Sites: Differentiating Data from Display")

Gerald Oskoboiny (gerald@pobox.com, http://pobox.com/~gerald/) is a computing science student at the University of Alberta in Edmonton, Canada. His interests include text processing, automation, user interface design, and methods of making information more accessible. His Web projects include the Hypertext Usenet Reader and Linker (http://pobox.com/~gerald/hurl/). (Chapter 33, "A Hypertext News Interface")

Carlos A. Pero (carlosp@ravenna.com, http://www.ravenna.com/) is vice president of technology at Ravenna Communications Corporation. Specializing in server-side operations and CGI, he is probably most recognized for his self-named coloring book and forms tutorial. A founding partner of Ravenna, he is helping to bring the Web to the Urbana-Champaign and Chicago areas. (Chapter 31, "A Web Coloring Book")

Michael D. Perry (wisdom@wisdom.com, http://www.wisdom.com/pcs/) is president of Progressive Computer Services, Inc., a commercial software publishing company in New Orleans. In addition to being Web master for the largest independent Internet service provider in Louisiana, he also has been the recipient of honors and awards for his software projects, including "Editor's Choice" in PC Magazine. (Chapter 29, "C-Based Gateway Scripting")

Adrian Scott, Ph.D. (scotta@rpi.edu), is the founder of Scott Virtual Theme Parks (http://www.virtpark.com/theme), one of the premiere VRML content companies. He is also an internet specialist at Hewlett-Packard (http://www.hp.com) involved in HP's Web site. He has previously been a visiting scholar in Hong Kong Polytechnic University's Department of Management. (Chapter 28, "Virtual Reality Modeling Language")

Kaitlin Duck Sherwood (ducky@webfoot.com, http://www.webfoot.com/ducky.home.html) is Web master for the University of Illinois at Urbana-Champaign and developer of a number of Web resources, including a free used-car advertising service, indexes to tourist resources, and a guide to effective e-mail usage. Previously, she spent 10 years in the electronics industry. (Chapter 32, "A Campus-Wide Information System")

Eric Tall (ebt@hydra.com) develops systems at Hydra Information Technologies (http://www.hydra.com) and The Lande Group (http://www.lande.com). He developed the WWW gateway to the Internet Chess Club and currently is working with Intel on a project to simulcast on the Internet an exhibition by the World Chess Champion. (Coauthored Chapter 24, "Scripting for the Unknown: The Control of Chaos," and Chapter 26, "Gateway Programming Language Options and a Server Modification Case Study")

Tell Us What You Think!

As a reader, you are the most important critic and commentator of our books. We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way. You can help us make strong books that meet your needs and give you the computer guidance you require.

Do you have access to CompuServe or the World Wide Web? Then check out our CompuServe forum by typing GO SAMS at any prompt. If you prefer the World Wide Web, check out our site at http://www.mcp.com.

Note
If you have a technical question about this book, call the technical support line at (800) 571-5840, ext. 3668.

As the team leader of the group that created this book, I welcome your comments. You can fax, e-mail, or write me directly to let me know what you did or didn't like about this book-as well as what we can do to make our books stronger. Here's the information:
Fax:317/581-4669
E-mail:Mark Taber  newtech_mgr@sams.mcp.com
Mail:Mark Taber
Comments Department
Sams Publishing
201 W. 103rd Street
Indianapolis, IN 46290


Introduction

The World Wide Web has grown rapidly since its introduction to the world in the early 1990s. Having gained the attention of millions of people in many segments of society, the Web is now a frequent subject of (and increasingly the delivery mechanism for) mass media reports. Advertisements and editorial content in many publications such as Newsweek, Time, The New York Times, and The Wall Street Journal now routinely use the Web's identifying scheme, the universal resource locator (URL), as a means for directing the user to further information. Although Web literacy and use is just in its nascent stage among a minority of the world's population today, the Web's capability to create a global audience for information has been recognized. Many organizations now use the Web to deliver information-ranging from government organizations such as the U.S. White House and the European Community to major corporations like Boeing and CBS. Small businesses, organizations, and individuals all over the world also use the Web for communication, information, and interaction.

This intense interest in the Web is a result of the potential it offers for communication. Using the Web, individuals or organizations can instantaneously and continuously present hypermedia-text images, movies, and sound-to a global audience. Today, many people use the Web's potential to serve information from tens of thousands of Web servers around the world to millions of users about subjects on just about every pursuit imaginable. This vast range of content includes informal home pages that individuals create, as well as systems of information for major institutions and corporations. With such a burgeoning of information content and variation in quality and value, Web users are taxed in their ability to make choices about what information to experience. For Web developers, this information environment demands excellent, effective content development in order to rise above the information clutter. With so much information on the Web, only that which truly meets user needs well can survive and flourish.

Because the Web is an expressive system of communication involving myriad choices for information development, creating effective communication for the Web relies on the skills of developers. Creating information that has meaning and value for users within the dynamic environment of the Web is no small task. Web development requires a broad range of skills in planning, analysis, design, implementation, promotion, and innovation, as well as communication.

Why This Book?

Knowledge of the Web has spread and grown with its use. Web information developers have relied on knowledge from on-line information lists and archives, electronic mail among colleagues, and trial-and-error experience to build their skills to shape and deliver communications using HyperText Markup Language and gateway programming. Until the fall of 1994, there were no printed, comprehensive books about the World Wide Web itself; since then, a flurry of books has provided information to developers, offering guidance on the technical issues of the Web, HyperText Markup Language, design, and some aspects of gateway programming. These technical issues are just one part of web development, however. There are other issues of planning, analysis, design, promotion, and innovation that also play a large role in creating effective communications on the Web.

This book directly addresses the need for a source of instruction and reference for all aspects of Web information development, including not just the technical issues, but also process and methodological issues of web information shaping. This book addresses the needs of advanced users and information professionals on an entire range of Web development topics and techniques. It covers information development processes such as planning, analysis, design, and promotion as well as technical issues such as HTML and gateway programming. It also gives guidance in the principles and techniques in the crucial meaning-shaping techniques of design, analysis, and style as well as meaning-dissemination techniques such as promotion. It helps the reader gain the skills to develop information and take part in the global conversation the Web is engendering.

Scope of This Book

This book presents tutorial and reference information on the concepts, techniques, skills, and resources required for developing information content for the World Wide Web. It covers processes of planning, analysis, maintenance, design, implementation in HTML, gateway programming, promotion, publicity, and innovation. It also includes chapters describing real-world case studies of web development and gateway and other programming in selected programming languages.

This book does not cover Web server setup or network administration. The http protocol is discussed in Part IV as it relates to gateway programming but otherwise is not discussed in detail. The book also is not meant as a guide for obtaining and setting up a World Wide Web browser. It is assumed that the reader has a browser available or can install one using the on-line instructions available and cited in this book. This book is, however, self-contained with respect to content development: It contains complete instruction in HTML and gateway programming as well as skills and concepts necessary for building and growing a web.

Gain Essential Skills for Web Development

This book provides the reader with complete information on HTML at all levels and gateway programming in popular implementation languages. It assumes that the reader is familiar with or can learn a programming language (such as Perl or C) for use in gateway programming. This book also includes, at the end of Chapter 3, a short "bootstrap" discussion for readers who might be just getting onto the Web for the first time and a tutorial on Web navigation in Chapter 1 as an overview for readers who need to be up to speed in Web information literacy.

Learn the Web's Structure and Potential for On-line Communication

Part I introduces the World Wide Web's technical components as well as its potential to reach a variety of audiences. The Web is a system for global, networked hypermedia that operates within the larger context of on-line cyberspace. The Web can provide information, communication, interaction, and computation services to individuals, groups, institutions, communities, or mass audiences. To access the Web, a user needs an Internet connection (possibly with a modem) and software; information providers on the Web also need to obtain server software and consider options for getting a domain name and leasing Web space.

Understand Processes to Develop Web Information

Part II examines the methodology that can be used to develop a web using a continuous-process, user-centered approach. This methodology involves planning, analysis, design, implementation, promotion, and innovation and draws on the human communication, information-shaping, and technical skills of the developers.

Learn Web Implementation Tools and Techniques

Part III delves into hypertext design and implementation issues in detail. In begins with a review of how the Web's qualities and characteristics as a communications medium lead to considerations in style and design; the eight chapters in this part explore specific topics of implementation. This part covers HTML at all levels, starting with the basic HTML at levels 0 and 1 and moving through level 2's FORM element and HTML 3.2's elements.

This part also describes special formats in multimedia: graphics, sound, and video, as well as the tools used for implementing hypertext. Finally, the development environments and new languages that can extend the Web's expressive possibilities are explored.

Master Gateway Programming

Part IV is a complete guide to all aspects of gateway programming-the key to providing interactive services on the Web. Starting off with the basic principles and fundamentals, this part presents many self-contained case studies in such areas as libraries, databases, text search and retrieval, and interactive applications. This part also reviews issues of gateway programming transactions and security as well as special topics and language options for gateway programming.

Examine Web Development Case Studies

Part V reviews special topics in Web development as well as complete case studies of implemented applications. This part begins with a chapter about techniques for dynamically generating HTML based on browser requests. It continues with a review of how the new language, Virtual Reality Modeling Language, can transform the Web. Then, it examines gateway programming in two other languages: C and REXX. Next, this part helps the developer integrate the principles and techniques presented throughout the book by seeing how real-world applications are constructed. It presents applications such as a coloring book that emphasizes interactive techniques with graphics, the process of creating and deploying a campus-wide information system, a hypertext interface to on-line discussion, and a graphical page counter.

How to Use This Book

This book's organization and contents can serve the needs of information developers, planners, designers, managers, and administrators in a variety of ways. The parts of the book gather key information in broad topic areas. Each chapter provides information that can be used as tutorial and reference information for several audiences. The on-line book support web at http://www.december.com/works/hcu.html gives you updates and supporting information.

Organization of This Book

This book is organized into parts containing chapters. Each part presents coverage of issues for a particular use and audience. The following table summarizes the coverage of the parts.

Part
Coverage
I
An overview of the Web as a system of communication; the Web's components and place in cyberspace; the Web's potential for information, communication, interaction, and computation services; and the options for connecting to the Web.
II
A methodology for information development for the Web; characteristics and qualities of the Web as a medium of communication; and the processes of planning, analysis, design, implementation, promotion, and innovation.
III
Details of implementation in HTML at all levels and extensions; forms, tables, and imagemaps; and tools, environments, and special languages, such as Java and Virtual Reality Modeling Language.
IV
Gateway programming; principles and fundamentals for adding interactivity to webs; case studies in information libraries, databases, text search and retrieval, interactivity; and special topics and language issues for gateway programming.
V
Language options for VRML, C, and REXX; and case studies of Web development in interactive graphics, information systems, hypertext discussions, and graphical counters.
VI
Sources of further information; summaries of tags for HTML; supporting information for implementation; and a glossary of terms.

Uses for This Book and Possible Paths

This book offers a wide range of information about Web development and serves the needs of beginning, intermediate, or advanced information developers who may be involved in the development process according to several roles. This book can be used for the following:

Orientation or executive overview  For people who just want to get a quick idea of the what the Web can provide and the basics of how information can be developed for the Web, Figure I.1 shows a possible track through this book. Chapter 2 presents the potential of what the Web can do, and Chapter 4 provides an overview of Web content development issues. For more in-depth coverage for an executive audience, the other chapters of Part I round out the coverage of the Web's components; and Chapters 32, 11, and 9 provide good overviews of a case study, design and implementation, and web promotion and business models. This is also a useful path for users of web information who might not be involved in information development in detail.

Figure I.1: Executive overview path.

Project management  Project managers and administrators can use this book to define processes for information development for the Web and to examine specific processes for skills and process requirements. Figure I.2 summarizes this path. Specialists in information development for the Web also can use this track along with in-depth study of their specialized chapter. Web marketers, for example, should examine Chapter 9 on promotion in detail, in addition to appreciating how promotion fits into the other processes of development.

Figure I.2: Project manager's/ administrator's path.

Information designers  Information designers who might not be involved in implementation can use this book as in Figure I.3. Starting with an understanding of the Web's components and potential, the designer should appreciate the general principles and structure of the development methodology, and then know the web design process and design issues in detail. For designers who might be using automated implementation environments, Chapter 18 presents an overview of some of the current possibilities.

Figure I.3: Information designer's path.

Web implementation  For Web implementers who will be working only with HTML (and not gateway programming), Figure I.4 shows a path through this book. Starting with an understanding of the Web's components and potential, the HTML developer should understand the development processes for the Web and the implementation and analysis processes in particular. An HTML implementer should know all of Part III in detail and read Chapter 32 for an idea of how implementation proceeds in a case study.

Figure I.4: HTML implementer's path..

Finally, Figure I.5 summarizes the path through the book required for a developer who will be involved with many aspects of web development and gateway programming in detail.

Figure I.5: Web developer's path.

Conventions Used in This Book

A glossary of terms related to the Web's technologies and development is provided near the end of this book. This book attempts to use standard terminology for HTML elements and entities as well as Web concepts and technologies.

This book uses the words "Web" and "web" with the following special meanings:

Web  (noun) the global collection of hypertext delivered using World Wide Web servers; (adjective) relating to the World Wide Web-for example, Web servers, Web browsers, and Web users.

web  (noun) a collection of hypertext considered to be a single work; often located on a single server or written by a single author or organization; (adjective) relating to a set of hypertext-for example, the web administrator, the web's marketing plan, and web development.

This book uses the following typographic conventions:

Book Support Web
To connect to the latest information about this book's contents, open the URL http://www.december.com/works/hcu.html. This support web provides links to on-line information about the book, updates on resources, and related information. Check with the errata page of this support web for corrections, and send reports of other errors or comments to john@december.com.