#!/usr/bin/perl
# " " " or use http://d...content-available-to-author-only...m.com/tools/smart-quotes.html to convert all smart quotes to straight #quotes
use warnings;
use strict;
use CGI;
my $bgcolor = "green";
my $filledcellcolor = "yellow";
my $emptycellcolor = "pink";
my $tablecols = 3;
my $tablerows = 20;
my ($i,$j);
#opens file p04.txt for writing
open(MYFILE
, "p04.txt") or die("\nError: cannot open file\n");
my @name = <MYFILE>;
my $parseCount;
&Parse_Form;
#this needs to be in a for loop that runs through the elements in an array
#if($formdata{"text$parseCount"} eq ""){
#$table[$parseCount] = $formdata{"text$parseCount"};
#}
my $cgi = CGI->new; #Instantiate a CGI class
#begin html page
$cgi->start_html('Super Bowl Party'),
# create the Tag <h1>TEXT</h1>
$cgi->h1("<center>Super Bowl Party Sign-up Sheet</center>"),
#header
$cgi->h2("<center>Project p04</center>"),
#header
$cgi->h3("<center>Adam Knutson</center>"),
$cgi->start_form();
print "<center><TABLE BORDER=1>";
#creates 3 columns and 20 rows of text boxes
my $count = 0;
for ($j = 0; $j <$tablerows; $j++)
{
for ($i = 0;$i < $tablecols; $i++)
{
if ( $name[$count] eq "" )
{
print "<TD BGCOLOR='".$filledcellcolor."' > <INPUT TYPE=TEXT NAME='text".$count."' SIZE=40 MAXLENGTH=50 VALUE='' background-color:'".$emptycellcolor."'> </TD>"; }
else
{
print "<TD> $name[$count]</TD>"; }
$count++;
}
}
open (MYFILE
, '>p04.txt'); my $newCount = 0;
#while conditions don't use 59, use number of columns*number of rows.
while ($newCount <59){
print MYFILE
"$name[$newCount] \n"; #print MYFILE "\n";
$newCount ++;
}
#Creates submit and reset buttons at bottom of page
print "</TABLE> <INPUT TYPE=submit NAME=submitButton VALUE='Submit Form'>
<INPUT TYPE=reset NAME=resetButton VALUE='Clear Form'>
</center>";
#print $cgi->end_form();
$cgi->h2("<center>Project p04</center>"),
$cgi->end_html; #end of HTML
IyEvdXNyL2Jpbi9wZXJsCiMgIiAgIiAgIiBvciB1c2UgaHR0cDovL2QuLi5jb250ZW50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