[ Previous ] [ Contents ] [ Index ] [ Next ]

How Web Pages Run CGI Programs

There are several ways a Web page can run a CGI program:

    
    <ISINDEX HREF="/cgi-bin/search.pl" PROMPT="Search for:"> 
Normally, the <ISINDEX> tag is used to run search programs, but this is not a requirement. You can use this tag to run CGI programs if you don't care where the field is located in your page and your program accepts a single variable.

When you use this tag, the browser adds a field to the Web page. (AOLpress adds it at the bottom of the page.) Readers can type a string in this field. The server decodes the text the reader typed and sends it to your CGI program as separate command-line arguments. The advantage is you don't need to decode the input.

URLs that Run CGI Programs

For each method of running a CGI program described in the previous section, the browser software sends a URL to the server. (In addition, the HTTP header sent with the URL includes some environment variables, which are described on Standard Environment Variables.)

Generally the URL to run a CGI program can have these parts:

CGI path[/extra path information ][?query string]

Field1=Value1&Field2=Value2&Field3=Value3

Spaces in the query string are replaced with plus signs (+). Any special characters (such as ?, =, &, +) are replaced with %xx, where xx is the hexadecimal value for that character. (See QUERY_STRING: for more on how the query string is encoded.)

Here are some examples of URLs that could run a CGI program:

If your programs are not executed, make sure the program file allows read and execute access.

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.