1 |
#!/usr/bin/perl -w |
2 |
|
3 |
use strict; |
4 |
use CGI qw/:standard -no_xhtml/; |
5 |
use DBI; |
6 |
|
7 |
my $url="http://www.nn.hr/CijeliBrojS.asp?god=%d&br=%d#%d"; |
8 |
|
9 |
my %labels = (''=>'naslovu', '_czs'=>'naslovu bez na¹ih slova'); |
10 |
|
11 |
print header(-charset=>'iso-8859-2'),start_html(-title=>'NN pretrazivanje',-lang=>'hr'),start_form; |
12 |
print "Tra¾i u ",popup_menu(-name=>'naslov_add',-values=>[ keys %labels ],-labels=>\%labels); |
13 |
print textfield('search'),submit; |
14 |
print end_form,hr; |
15 |
|
16 |
if (param('search')) { |
17 |
my $dbh = DBI->connect("DBI:Pg:dbname=nn","dpavlin","") || die $DBI::errstr; |
18 |
my $sql="select br,god,aname,nr,title from nn where title".param('naslov_add')." like '%".param('search')."%'"; |
19 |
my $sth=$dbh->prepare($sql) || die $dbh->errstr(); |
20 |
# $sth->execute(param('search')) || die $dbh->errstr(); |
21 |
$sth->execute() || die $dbh->errstr(); |
22 |
#print "<pre>$sql</pre>"; |
23 |
while (my $row = $sth->fetchrow_hashref()) { |
24 |
print br,"<tt><a href=\"",sprintf($url,$row->{god},$row->{br},$row->{aname}),"\">NN",$row->{god},"/",$row->{br},"</a> ",$row->{nr},"</tt> ",$row->{title},"\n"; |
25 |
} |
26 |
} |
27 |
|