Basic HTML version of Foils prepared 2 Sept 1997

Foil 8 Pass Data to a CGI Program through Environment Variables

From CGI Programming with Advanced Topics Jackson State University Mississippi -- Fall Semester 97. by Nancy McCracken *

Two environment variables QUERY_STRING and PATH_INFO are used to pass data to the CGI program - there are several ways to do this.
Using a normal HTML link to pass data:
  • Everything after the first question mark in a URL is put into the QUERY_STRING variable:
  • <a href="http://www.some.box/sign.pl?passed-argument"> Click here to run the program. </a>
  • The QUERY_STRING variable is "passed-argument".
  • Everything after an executable in the path name is put into the PATH_INFO variable:
  • <a href="http://www.some.box/walk.pl/direction=north/speed=slow"> Start the program. </a>
  • The PATH_INFO variable is "direction=north/speed=slow".
  • These techniques are required by some search engines, such as WAIS, to pass keywords for the search.



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Tue Sep 2 1997