Search Gene:
<html>
<head>
<title>Search genedb table</title>
</head>
<body>
<form method="POST" action="/~golharam/cgi-bin/5004/searchgene.cgi">
Input name of gene: <input name="genename"><br>
<input type="submit" value="Find">
</form>
</body>
</html>
CGI:
#!/usr/bin/perl
use warnings;
use strict;
# Pre-work
use CGI;
use DBI;
print "Content-type: text/plain\n\n";
# 1. Get input from HTML form
my $q = new CGI;
my $gene = $q->param("genename");
# 2. Search the database, and print the results
my $dbh = DBI->connect('dbi:mysql:golharam:serine') || print "Unable
to connect
to the database: $DBI::errstr";
my $sth = $dbh->prepare("SELECT taxid, chromosome, featureName, featureType
from
genedb WHERE featureName='$gene' and taxid=9606");
$sth->execute();
my @row;
while (@row = $sth->fetchrow_array) {
print "@row\n";
}
$sth->finish();
$dbh->disconnect();
Search Pet:
<html>
<head>
<title>Search PET table</title>
</head>
<body>
<form method="POST" action="/~golharam/cgi-bin/5004/searchpet.cgi">
Input species here: <input name="species"><br>
<input type="submit" value="Submit Information">
</form>
</body>
</html>
CGI:
#!/usr/bin/perl
use warnings;
use strict;
# Pre-work
use CGI;
use DBI;
print "Content-type: text/plain\n\n";
# 1. Get input from HTML form
my $q = new CGI;
my $speciestype = $q->param("species");
# 2. Search the database, and print the results
my $dbh = DBI->connect('dbi:mysql:golharam:serine') || print "Unable
to connect
to the database: $DBI::errstr";
my $sth = $dbh->prepare("SELECT * from pet WHERE species='$speciestype'");
$sth->execute();
my @row;
while (@row = $sth->fetchrow_array) {
print "@row\n";
}
$sth->finish();
$dbh->disconnect();