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