Basic HTML version of Foils prepared Sept 20 97

Foil 79 Using CGI.pm - Form Processing

From Tutorial on PERL Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


Here's an example how to use CGI.pm to process form data:
print header(-type=>'text/html'); # MIME header
print start_html( # first few lines of HTML
  • -title=>'Pizza Order Form',
  • -BGCOLOR=>'#ffffff'
  • );
print h1( 'Pizza Order' );
print h3( "$TOPPING pizza" ); # $TOPPING = param(topping);
print p( "Deliver to: <B>$ADDR</B>" ); # $ADDR = param(address);
print p( "Telephone: <B>$PHONE</B>" ); # $PHONE = param(phone);
my $date = `date`; chomp($date);
print p( "Order came in at $date" );
print hr();
# Print a link:
print 'Return to ';
print a({href=>"fill-out-form.pl"}, # an anonymous hash
  • 'HTML form'
  • );
print end_html(); # last few lines of HTML



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Sep 21 1997