}
$match_stddev = $parms{-2} * sqrt(2.0);
-my $season = $cgi->param('sesong') // -1;
+my $season;
my $division = $cgi->param('divisjon') // -1;
my $subdivision = $cgi->param('avdeling') // -1;
<p>Spillerne er sortert etter nick.</p>
<form method="get" action="/">
- <p>Sesong:
- <select name="sesong">
EOF
-$q = $dbh->prepare('SELECT DISTINCT(sesong) FROM fotballserier ORDER BY sesong');
+$q = $dbh->prepare('SELECT MAX(sesong) AS max_sesong FROM fotballserier');
$q->execute;
-my $max_season;
-my @seasons = ();
+my $season;
while (my $ref = $q->fetchrow_hashref) {
- push @seasons, $ref->{'sesong'};
- $max_season = $ref->{'sesong'};
-}
-
-my $found_season = 0;
-for my $s (@seasons) {
- if ($s == $season || (!$found_season && $s == $max_season)) {
- print " <option value=\"$s\" selected=\"selected\">$s</option>\n";
- $season = $s;
- $found_season = 1;
- } else {
- print " <option value=\"$s\">$s</option>\n";
- }
+ $season = $ref->{'max_sesong'};
}
print <<"EOF";
- </select>
- Divisjon:
+ <p>Divisjon:
<select name="divisjon">
EOF