htmlformatting.cgi
#!/usr/bin/perl if ($ENV{'REQUEST_METHOD'} eq 'GET') { @pairs = split(/&/, $ENV{'QUERY_STRING'}); } elsif ($ENV{'REQUEST_METHOD'} eq 'POST') { read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); if ($ENV{'QUERY_STRING'}) { @getpairs =split(/&/, $ENV{'QUERY_STRING'}); push(@pairs,@getpairs); } } else { print "Content-type: text/html\n\n"; print "<P>Use Post or Get"; } print "Content-type: text/html\n\n"; print "<HTML><HEAD>\n<title>"; print "Showing off with HTML"; print "</title>\n</HEAD><BODY>\n"; print "<h2>Thanks for responding. Here's what you told us:</h2>"; print "<TABLE BORDER=3 WIDTH=60%>\n"; print "<TR><TH>Key<TH>Value\n"; foreach $key (keys %formdata){ print "<TR><TD>$key<TD>$formdata{$key}\n"; } print "</TABLE>"; print "</BODY></HTML>";
Last updated: 05/19/2025 23:43:02