Internet Marketing Home
Send Email to Us

Table of Contents
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 15
Chapter 16
Chapter 17
Chapter 18
Chapter 19

Chapter 14: CGI
Sample Script

When the consumer submits his or her information, it is handed to a CGI program or script which then performs some kind of task and subsequently sends some feedback to the consumer in the form of a new web page created on the fly.

The CGI script called by the test form looks like:

    #!/bin/sh
    #
    read TEXT
    #
    echo Content-type: text/html
    echo
    echo "<html>"
    echo "<head>"
    echo "<TITLE>This is a CGI test Script</TITLE>"
    echo "</head>"
    echo "<body>"
    echo "<h2>CGI Test Script</h2>"
    echo "<p>"
    echo "$TEXT"
    echo "</body>"
    echo "</html>"
    
The "#" sign creates a comment. The first comment identifies this program as a Bourne Shell Script made up of Unix commands.

The Unix read command reads the output from the form while the echo creates the HTML which will be shown to the consumer. Notice that near the end of this script there is an echo command which echos the TEXT variable read from the form and embeds it in the new outgoing page.


Copyright 1998 by Digital Springs, Inc. All Rights Reserved.