sub storeData { my $table = shift; my $grades = getGrades(); my $standards = getStandards(); use DBI; my $dbh = DBI->connect("DBI:mysql:$database",$user,$password); $dbh->{RaiseError} = 1; # save template information to database my $sql = 'INSERT INTO ' . $table . '(title, lesson_summary, grades, standards) VALUES (?, ?, ?, ?)'; my $sth = $dbh->prepare($sql); $sth->execute( $template->param('Title'), $template->param('Summary'), $grades, $standards ); $template->end_html; $sth->finish; $dbh->disconnect; print $template->redirect('http://www.someserver.com/some/path/thanks.html'); }