Leser: 1
10 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/perl -wT
use strict;
use CGI qw/:standard/;
use DBI;
print header,
start_html('Database Interface'),
h1('<font color=blue>first test of a query! Just in a few DNA-Sequences:</font>'),hr,
start_form,
textarea( -name =>'input',
-default=>'Enter your sequence here...',
-rows=>'10',
-columns=>'50'),br,
'<font color=blue>Choose the table: </font>',
popup_menu( -name =>'table',
-values =>[qw/dnaseq protseq/],
-labels =>{'dnaseq'=>'DNA-Sequences','protseq'=>'Protein-Sequences'}),p,
submit('subm','submit'),p,
end_form,
hr;
my $popup_menu_value = param('table');
my $input;
my @result;
if( $popup_menu_value eq "dnaseq"){
$input = uc param('input'); #uc wandelt Klein- in Großbuchstaben um
}
else{
$input = lc param('input'); #lc wandelt Groß- in Kleinbuchstaben um
}
import_names('items');
if ($items::subm) {
my $table = param('table');
my $query = "select * from $table where seq like '%$input%';";
my $dbname = 'perl';
my $seqs = DBI->connect("dbi:Pg:dbname=$dbname",'marc','')
or die "Kann keine Verbindung herstellen: $DBI::errstr";
my $sql = $seqs->prepare($query)
or die "Kann die Abfrage nicht vorbereiten: $DBI::errstr";
$sql->execute();
print "Result is:",p;
print(" <table border=0 width=80%>
<colgroup>
<col width=50>
<col width=80>
</colgroup>
<th align=left>#</th>
<th align=left>Sequence</th>");
my $counter = 0;
while(@result = $sql->fetchrow_array() ){
$counter++;
print(" <tr> <td>",checkbox($counter),"</td>",
"<td> <A HREF='details.cgi?art=$result[ 1 ]'>$result[ 1 ]</A></td></tr>");
}
print("</table>");
print start_form,
submit('show','show'),p,
end_form,
hr;
}
elsif ($items::show) {
print ( ... );
}
1
2
3
4
5
while(@result = $sql->fetchrow_array() ){
$counter++;
print(" <tr> <td>",checkbox('cb'.$counter,0,'1',$counter),"</td>",
"<td> <A HREF='details.cgi?art=$result[ 1 ]'>$result[ 1 ]</A></td></tr>");
}
1
2
3
4
5
6
7
elsif ($items::show) {
my %daten = Vars();
foreach my $key(sort keys (%daten)){
print $key . " = " . $daten{$key} . "\n";
}
}
1
2
3
4
<form method="POST">
<input type="checkbox" name="BOX01" value="SomeValue">
<input type="submit" value="submit"><input type="reset" value="reset">
</form>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/perl -wT
use strict;
use CGI qw/:standard/;
use DBI;
print header,
start_html('Test von CGI'),
h1('<font color=blue>Details of the Sequence:</font>'),
"<a href='jo.cgi'>back</a>",
hr;
our @result;
my $input;
my $popup_menu_value;
if ( defined(param('input')) ){
$input = param('input');
}
if ( defined(param('table')) ){
$popup_menu_value = param('table');
}
if( $popup_menu_value eq "dnaseq"){
$input = uc param('input'); #uc wandelt Klein- in Großbuchstaben um
}
else{
$input = lc param('input'); #lc wandelt Groß- in Kleinbuchstaben um
}
my $table = param('table');
my $query = "select * from $table where seq like '%$input%';";
my $dbname = 'perl';
my $seqs = DBI->connect("dbi:Pg:dbname=$dbname",'marc','')
or die "Kann keine Verbindung herstellen: $DBI::errstr";
my $sql = $seqs->prepare($query)
or die "Kann die Abfrage nicht vorbereiten: $DBI::errstr";
$sql->execute();
print "Result is:",p;
print(" <table border=0 width=80%>
<colgroup>
<col width=50>
<col width=80>
</colgroup>
<th align=left>#</th>
<th align=left>Sequence</th>");
my $counter = 0;
print start_form;
while(my @row = $sql->fetchrow_array() ){
push(@result,@row);
$counter++;
print(" <tr> <td>",checkbox('cb'.$counter,0,'1',$counter),"</td>",
"<td> <A HREF='details.cgi?art=$row[ 1 ]'>$row[ 1 ]</A></td></tr>");
}
print submit('show','show'),p;
print "Länge: ",$#result,"<p>";
if(param('show') ){
print "Länge: ",$#result,"<p>";
print "Param cb1: ",param('cb1');
for(my $i=0; $i <= $#result; $i++){
if(param('cb').$i+1 == 1){
print $result[$i];
}
}
}
if(param ('show') )
10 Einträge, 1 Seite |