#!/usr/bin/perl
# Program Name: X.pl
# Author: D. W. Hyatt
# This program uses the data passed by the form program and creates
# a new web page with that information.
#### SETUP STUFF -- just copy it. ####
use CGI qw/:standard :newtag/; # NOTE the space after ":standard" (before "newtag:")
print<
STUFF
my $file= "X";
### Get parameters from html form.
#
my %in;
foreach (param()){
$in{$_} = join " ", param($_);
}
# NOTE: Use curly brackets {} not parentheses () #
$name = $in{"name"}; # Get the user's name and assign to variable
$preference = $in{"choice"}; # Get the choice and assign to variable
$many = $in{"many"};
$bg = $in{"bg"};
if ("$bg" eq "") {
$bg="FFFFFF";
}
if ("$bg" eq "FF0000") {
$bg="FFFF00"; # Change RED to YELLOW
}
#### Now send some more HTML stuff to make the web page. ####
print ""; # Use "..." (not '...') to allow substitution
print " Hello, $name!
\n";
print < Here is your order:
STUFF
for (my $i=0; $i<$many; $i++) {
print "- $preference\n";
}
print <
Return to form.
TOP
BOTTOMSTUFF