#!/perl/bin/perl
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use DBI;
print header();
print start_html();
$db="products";
$host="localhost";
$user="root";
$password="football";
@img=('/picture/oracle1.jpg','/picture/oracle2.jpg'
,'/picture/oracle3.jpg','/picture/oracle4.jpg'
,'/picture/oracle5.jpg','/picture/oracle6.jpg'
,'/picture/oracle7.jpg','/picture/oracle8.jpg'
,'/picture/oracle9.jpg');
$bookname=param('booktitle');
$index=0;
$counter=0;
my $dbh = DBI->connect ("DBI:mysql:database=$db:host=$host",
$user,
$password)
or die "Can't connect to database: $DBI::errstr\n";
my $sth = $dbh->prepare(qq(SELECT picture, stocknum,itemname,price FROM tblKite WHERE
status !="out" ORDER BY price));
$sth->execute();
print qq(<html>
<head>
<style type=text/css>
table
{ margin-left:15%;
}
td
{color:black}
td
{font-family:courier}
font{font-size:100%;
color:brown; filter:glow( color=yellow,strength=5);
width:100%}
</style>
</head>
<body bgcolor=#d56321>
<center> following Item are Found </center>
<form action="order.pl" method="POST">
<table border=1>);
while (($picture,$stocknum,$name,$price) = $sth->fetchrow_array)
{ if(index(lc($name), lc($bookname)) > -1)
{
print qq(<tr>
<td bgcolor=white><img src=$img[$index]></td>
<td align="middle">\$$price</td>
<td align="middle"><b>$name</b></td>
<td align="middle" bgcolor=black><input type=text size=5
name=$stocknum></td>
</tr>);
$counter +=1;
}
$index=$index+1;
}
if($counter>0)
{ print qq(<tr><td></td><td><input type="reset" value=ClearForm></td>
<td></td><td><input type=submit
value=AddtoCart></td></tr></table></form></body</html>);
print qq(<center>there are $counter item found</center>);
}
else
{
print qq(<p>No books found.</p>\n);
}
exit;