main.pl #!/usr/bin/perl -w use CGI; use DBI; use Template; my $cgi = CGI->new(); my $html = Template->new; my $host = "sql2.freemysqlhosting.net"; my $usr = "sql2343290"; my $pwd = "qV5*gE2%"; my $dbname = "sql2343290"; my $dbh = DBI->connect("DBI:mysql:$dbname:$host", $usr, $pwd, { AutoCommit => 0, RaiseError => 1, }) or die $DBI::errstr; my $select_names = $dbh->prepare("select id, name from names"); $select_names->execute(); my $names = $select_names->fetchall_arrayref(); $dbh->disconnect; print "Content-type: text/html\n\n"; my $temp_html = < Untitled Document

content

======================================================
|
|content
|
-------------------------------------------------------

after submit relond only content in this div (box)

 

[% FOREACH name IN list %]

Name: [% name.1 %]

[% END %]


---------------------------------------------------------
|
| content
|
======================================================

content

START_HTML $html->process (\$temp_html, { list => $names}) or die $html->error;