#!/usr/local/bin/perl
# see http://www.hut.fi/u/jkorpela/forms/testing.html
require "cgi-lib.pl";
if (&ReadParse) {
print &PrintHdr, &PrintTitle;
print &PrintVars;
} else {
print &PrintHdr, &PrintTitle;
print '
(No data)';
}
sub PrintHdr {
return "Content-type: text/html;charset=iso-8859-1\n\n";
}
sub PrintTitle {
return '
Results';
}
sub PrintVars {
local (*in) = @_ if @_ == 1;
local (%in) = @_ if @_ > 1;
local ($out, $key, $output);
$output = "\nEchoing submitted form data
\n";
foreach $key (sort keys(%in)) {
foreach (split("\0", $in{$key})) {
($out = $_) =~ s/&/&/g;
($out = $out) =~ s/</g;
($out = $out) =~ s/>/>/g;
($out = $out) =~ s/\r\n/
/g;
($out = $out) =~ s/\n/
/g;
$output .= "$key
\n\n";
}
}
$output .= "\n";
return $output;
}