!/usr/bin/perl

# Program Name: X2a.pl
# Author: Afsar
# 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; 			# NOTE:  BEmpty line is required after "Content-type: text/html"
Content-type: text/html

<HTML>
STUFF



my $file=  "X2a";


### 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"};


#### Now send some more HTML stuff to make the web page. ####
print "<BODY BGCOLOR=#FFFF00>";				# Use "..." (not '...') to allow substitution
print "<H1 ALIGN=CENTER> Hello, $name! </H1>\n";


print <<STUFF;
	<P> Here is your order:
	<UL>
STUFF

for (my $i=0; $i<$many; $i++) {
	print "<LI> $preference\n";
}


print <<BOTTOMSTUFF;
	</UL>
	<P ALIGN=CENTER>
	<A HREF="$file.html"> Return to form. </A>
	<HR>
	<BR>
	<A HREF=#TOP> TOP </A>
BOTTOMSTUFF



















