## Read the current vote number from the mySQL database. my $dbh = DBI->connect("DBI:mysql:$database","$username","$password") || error_fatal ("[ vote.cgi: Admin: Unable to open mySQL database - $! ]"); my $sth_1 = $dbh->prepare("SELECT current_vote FROM vote_count"); $sth_1->execute(); my @vote_no = $sth_1->fetchrow_array; $sth_1->finish(); my $current_vote = $vote_no[0]; # Subroutines. ## Form printing subroutine. sub print_form { ### Read the data from the mySQL database. my $dbh = DBI->connect("DBI:mysql:$database","$username","$password") || error_fatal ("[ vote.cgi: Admin: Unable to open mySQL database - $! ]"); my $sth_2 = $dbh->prepare("SELECT description FROM vote_misc WHERE vote_no='$current_vote'"); $sth_2->execute(); my $description = $sth_2->fetchrow_array(); $sth_2->finish(); my $sth_3 = $dbh->prepare("SELECT option_1,option_2,option_3,option_4,option_5,option_6 FROM vote_text WHERE vote_no='$current_vote'"); $sth_3->execute(); my @options = $sth_3->fetchrow_array(); $sth_3->finish(); ### Print the submission form using the values gathered from the mySQL database. print "Content-type: text/html\n\n"; print "\n"; ### Heading. print "
\n"; print ""; exit; }