Basic HTML version of Foils prepared 2 Sept 1997

Foil 9 Another way to pass data through environment variables

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

1 Using the method "get" in a form to pass data, all the input that the user types is put in the QUERY_STRING variable:
2 <form method=get action="http://www.some.box/name.pl">
3 Type your first name <input name="First Name"><br>
4 Type your last name <input name="Last Name"><br>
5 <input type=submit value="submit">
6 </form>
7 If the user types "Winona" and "Ryder" as values, the QUERY_STRING environment variable would have the encoded value "First+Name=Winona&Last+Name=Ryder".
8 Here is a Perl program that would print that string on the web client's window (without regular html tags):
9 #!/usr/local/bin/perl
10 print "Content-type: text/html\n\n";
11 print "You typed \"$ENV{QUERY_STRING}\" in the input boxes\n";
12 Method=Get is NOT RECOMMENDED for forms as long input can be lost!

in Table To:


© 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