#!/opt/bin/perl # $Header: /cys/people/brenner/http/docs/web/RCS/combined-form.cgi,v 1.4 1996/03/29 22:59:29 brenner Exp $ # Copyright (C) 1994 Steven E. Brenner # This is a small demonstration script to demonstrate the use of # the cgi-lib.pl library, where the script both creates the form and # processes its input require "cgi-lib.pl"; MAIN: { # Read in all the variables set by the form if (&ReadParse(*input)) { &ProcessForm; } else { &PrintForm; } } sub ProcessForm { # Print the header print &PrintHeader; # Do some processing, and print some output ($text = $input{'text'}) =~ s/\n/\n
/g; # add
's after carriage returns # to multline input, since HTML does not # preserve line breaks $input{'comments'} =~ s/\x0d//g; open (COMMENTSFILE,">>anon103"); print COMMENTSFILE "Comments:\n"; print COMMENTSFILE "$input{'comments'}"; print COMMENTSFILE "\n"; print COMMENTSFILE "\n"; print COMMENTSFILE "\n"; close COMMENTSFILE; print < Thanks!

Thanks!

Thanks for your comments. I appreciate them and will try to use them to improve the class.

Return to Bryan Caplan's Econ 103 Page

Return to Bryan Caplan Homepage

ENDOFTEXT # Close the document cleanly. print &HtmlBot; } sub PrintForm { print &PrintHeader; # Print out the body of the form from a single quoted here-document # Note that if ENDOFTEXT weren't surrounded by single quotes, # it would be necessary to be more careful with the other text # For example, the @ sign (in the address) would need to be escaped as \@ print <<'ENDOFTEXT'; Anonymous Econ 103 Comments Form

Anonymous Econ 103 Comments Form

I would like to get your comments about the class now, while I can still do something about them. The form below will permit you to make anonymous comments to me about the class. Remember, I won't know who wrote your comments, so feel free to speak your mind.

Write your comments in the box below.



ENDOFTEXT print &HtmlBot; }