use warnings;
use strict;
use CGI; ##### Bring CGI module into program
use CGI::Carp qw(fatalsToBrowser); ### displays all errors onto browser
my $q = new CGI;
my $dbh = DBI->connect( 'dbi:mysql:host=xxxxxxxx; sid=xxxx;port=xxxxx',
'user',
'pass', { RaiseError => 1, AutoCommit => 0}
) || die "Database connection not made: $DBI::errstr\n";
my $start =$q -> param('Num');
if ($start)
{
my $sql_A=qq{ SELECT sname from employee where id = '$start'};
my $sth_A = $dbh->prepare ($sql_A)|| die "Prepare failed: $DBI::errstr\n";
$sth_A->execute() || die "Couldn't execute query:$DBI::errstr\n";
print "Content-Type: text/html\n\n";
print "<html><body>";
print "<BODY leftmargin=0 topmargin=0>";
print "<table height=\"100%\" width = \"100%\" cellpadding = \"0\" cellspacing = \"0\" border = \"2\" align = \"center\">";
print "<tr height=\"5%\">";
print "<td align = \"center\" colspan =\"2\" bgColor=\"blue\">";
print "<FONT face=\"Times New Roman\" size=\"5.5\" Color =\"White\"> Result </font>";
print "</td>";
print "</tr>";
print "<tr height=\"90%\">";
print "<td width = \"100%\" colspan = \"2\">";
print "<br>";
print"<br>";
print "<table align=\"center\" bgcolor=\"#E5EEF3\" border=2 bordercolor=\"navy\" >";
print "<tr>";
print"<td><b> Employee Name</b></td>";
while (my @row= $sth_A->fetchrow_array())
{
foreach my $my_td (@row) { print "<td>$my_td</td>\n"; }
}
$sth_A->finish();
print "</tr>\n";
print "</table>";
print "<br>";
$dbh->disconnect() || die "Failed to disconnect\n";
print "<br>";
print "<tr height=\"5%\">";
print "<td align = \"center\" colspan =\"2\" bgColor=\"navy\"> </td>";
print "</tr>";
print "</table>";
print "</body></html>";
}
else
{
print "Content-Type: text/html\n\n";
print "<html><body>";
print "<BODY leftmargin=0 topmargin=0>";
print "<table height=\"100%\" width = \"100%\" cellpadding = \"0\" cellspacing = \"0\" border = \"2\" align = \"center\">";
print "<tr height=\"5%\">";
print "<td align = \"center\" colspan =\"2\" bgColor=\"navy\">";
print "<FONT face=\"Arial\" size=\"5.5\" Color =\"White\"> Error </font>";
print "</td>";
print "</tr>";
print "<tr height=\"90%\">";
print "<td width = \"100%\" colspan = \"2\">";
print "<table align=\"center\" bgcolor=\"aliceblue\" border=2 bordercolor=\"navy\" >";
print "<tr>";
print "<td><b>No Data were entered , Please go back and enter data again !! </b></td>";
print "</tr>";
print "</table>";
print "<A href=
Go Back </B>";
print "<tr height=\"5%\">";
print "<td align = \"center\" colspan =\"2\" bgColor=\"navy\"> </td>";
print "</tr>";
print "</table>";
print "</body></html>";
}
---------------------------------------------------------------------------------------------------------------------------------------------
let us know if still more information is needed
Happy Coding

ronan