#!/usr/bin/perl print "Content-type:text/html\n\n"; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } # Since the "how you reached this site" list was saved as a number, # we need a hash to translate it back to english: %howreach = (1 => "Typed the URL directly", 2 => "Site is bookmarked", 3 => "A search engine", 4 => "A link from another site", 5 => "From a book", 6 => "Other" ); print <Results

Results

Here's what you entered:

Your name: $FORM{'name'}

Email: $FORM{'email'}

How you reached this site: $howreach{$FORM{'howreach'}}

How you'd rate this site (1=poor,5=excellent): $FORM{'rating'}

EndHTML ; %boxes = ("des" => "Website Design", "svr" => "Web Server Administration", "com" => "Electronic Commerce", "mkt" => "Web Marketing/Advertising", "edu" => "Web-related Education" ); print "You're also involved in the following:
\n"; foreach $key (keys %boxes) { if ($FORM{$key} == 1) { print "$boxes{$key}
\n"; } } print < Your comments:
$FORM{'comments'}

EndFoot ;