HELP! * GREY=local LOCAL HTML version of Foils prepared 18 March 97

Foil 7 Pass Data to a CGI Program through Environment Variables

From Introduction to CGI Programming CPS616 Spring 97 -- Spring Semester 97. by Nancy J. McCracken * See also color IMAGE

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 Apr 29 1997