#!/usr/bin/perl -w
use strict;
use warnings;
use DBI;
use Mylib;
use CGI;
my $Cgi = new CGI();
print $Cgi->header,
$Cgi->start_html;
# keyword is the name of the text field in the form.
Mylib->DisplayEmptyError('Keyword') unless ($Cgi->param('keyword'));
&DisplayMatches();
print $Cgi->end_html;
sub DisplayMatches
{
my $dbh = Mylib->OpenMyDB();
my $directory = '/mydir/';
my $keyword = $Cgi->param('keyword');
my $dbq = $dbh->prepare("SELECT * FROM mytable WHERE myfield LIKE '%$keyword%'");
$dbq->execute();
print "<table border='1'>";
print "<tr><td>Person</td><td>Summary</td><td>Filename</td></tr>";
while(my ($pn, $sum, $fn) = $dbq->fetchrow_array())
{
print "<tr><td>$pn</td><td>$sum</td>";
print "<td><a href='$directory$fn' target='_blank'>$fn</a></td></tr>\n";
}
print "</table>";
$dbh->disconnect;
}