#!/usr/local/bin/perl #Change this path! $COMMENT_FILE = "/home/boutell/comments.txt"; require "cgi-lib.pl"; print "Content-type: text/html\n\n"; print "\n"; print "\n"; #Parse the form arguments. Indicate that we want #the results to appear in "values". &ReadParse(*values); #Use the information #If any field is missing, complain! if ((! $values{"name"}) || (! $values{"email"}) || (! $values{"comments"})) { print "Please fill out all the fields\n"; print "\n"; print "

Please fill out all the fields

\n"; print "Please fill out the name, email address, AND\n"; print "comment fields. Back up to the previous page\n"; print "to try again.\n"; print "\n"; exit 0; } #OK, we have all the data. Write it to a file in which #we collect comments from users. Open to append, of course. $fname = ">>" . $COMMENT_FILE; open(OUT, $fname); print OUT "From: ", $values{"name"}, " <", $values{"email"}, ">\n"; print OUT $values{"comments"}, "\n"; close(OUT); print "Thank you, ", $values{"name"}, "\n"; print "\n"; print "

Thank you, ", $values{"name"}, "

\n"; print "Thank you for your comments.\n"; print "\n"; exit 0;