1 #!/usr/npac/bin/perl -w 2 # 3 # File: feedback.pl 4 5 use strict; 6 # Import a standard set of methods from CGI.pm (see 7 # page 187 of the Llama book for details): 8 use CGI qw(:standard); 9 10 # Default title of the generated web page: 11 my $title = 'Course Feedback Form'; 12 13 # An alternate title may be specified in the URL: 14 $title = param('title') if defined(param('title')); 15 16 # It would be nice to allow the user to specify these as well, 17 # but we need to consider the security implications first: 18 my $mailto = 'trscavo@npac.syr.edu (Tom Scavo)'; 19 my $archive = 'archives/feedback.txt'; 20 21 # Print header (the MIME type 'text/html' is understood by 22 # default, but is given here for clarity): 23 print header(-type=>'text/html'); 24 25 # Print first few lines of the HTML document: 26 print start_html( 27 -title=>"$title", 28 -author=>'trscavo@npac.syr.edu', 29 -BGCOLOR=>'white' 30 ), "\n"; # all newlines are for visual formatting only 31 32 # Print a heading: 33 print h1("$title"), "\n"; 34 35 # Print <FORM> tag (whose ACTION is the current script, by default): 36 print start_form( 37 -method=>'POST', 38 -action=>'http://osprey7.npac.syr.edu:3768/users-cgi/trscavo/prod/mailform', 39 ); 40 41 # Print various hidden fields used by the mailform script: 42 print hidden( 43 -name=>'_mailTo', 44 -default=>"$mailto" 45 ), "\n"; 46 print hidden( 47 -name=>'_mailSubject', 48 -default=>"$title" 49 ), "\n"; 50 print hidden( 51 -name=>'_mailArchive', 52 -default=>"$archive" 53 ), "\n"; 54 55 # Print a textarea for user comments: 56 print "Type your comments or suggestions below:\n"; 57 print p( textarea( 58 -name=>'Comments', 59 -rows=>10, 60 -columns=>60 61 ) 62 ), "\n"; 63 64 # Print a textfield for the user's e-mail address (optional): 65 print "If you would like a personal reply,\n"; 66 print "please type in your e-mail address:\n"; 67 print p( textfield( 68 -name=>'_mailFrom', 69 -size=>50 70 ) 71 ), "\n"; 72 73 # Print submit and reset buttons: 74 print p( submit('Send'), 75 reset('Clear') 76 ), "\n"; 77 78 # Print </FORM>: 79 print end_form(), "\n"; 80 81 # Print last few lines of HTML document: 82 print end_html(), "\n";