#Volunteer.pl - Insert Volunteers into database use strict; use DBI; use CGI qw(:standard); my $query = CGI::new(); my ($dbh, $sth, $sql); my @volunteer_date = $query->param("Volunteer"); my $parent = $query->param("Parent"); my $user = $query->remote_user(); #my $user = ""; #my $name = undef; my $name = (); my $date = (); my $sub_parent = (); #my $parent = "Father"; #my @volunteer_date = ("2002-01-18"); print $query->header(), $query->start_html (-title=>'Volunteer List Form', -link=>'#FFFFFF', -vlink=>'99FF99', -alink=>'black', -style=>{'-src'=>'/CSS/stylesheet.css'} # store subparent for each parent my %parent_hash = ( 'Father' => 'Mother', 'Mother' => 'Father' ); if ( @volunteer_date ){ if (exists $parent_hash{$parent}) { my $sub_parent = $parent_hash{$parent}; for my $col ( $parent, $sub_parent ) { my $sql = "select $col from Roster where User=?"; my $sth = $dbh->selectcol_arrayref( $sql, undef, $user ); if ( @$sth && $sth->[0] ) { # any rows returned? $name = $sth->[0]; # take first one last; } } } print $query->h1({-align=>'center'},"THANK YOU FOR SIGNING UP $name"); foreach $date ( @volunteer_date ) { $sql = "select distinct Volunteer from Volunteer where Volunteer =? and Date =?"; my $sth = $dbh->selectcol_arrayref( $sql, undef, $name, $date ); #Verify the parent is not signed up. if( @$sth ) {