use strict;
use CGI;
use C4::Context;
-use C4::Output;
-
use C4::Auth;
-use C4::Interface::CGI::Output;
+use C4::Output;
sub StringSearch {
- my ($env,$searchstring,$type)=@_;
+ my ($searchstring,$type)=@_;
my $dbh = C4::Context->dbh;
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my $sth;
if ($input->param('cityid') ){
- $sth=$dbh->prepare("replace cities (cityid,city_name,city_zipcode) values (?,?,?) ");
- $sth->execute(map { $input->param($_) } ('cityid','city_name','city_zipcode'));
+ $sth=$dbh->prepare("UPDATE cities SET city_name=?,city_zipcode=? WHERE cityid=?");
+ $sth->execute($input->param('city_name'),$input->param('city_zipcode'),$input->param('cityid'));
}
else{
- $sth=$dbh->prepare("replace cities (city_name,city_zipcode) values (?,?)");
- $sth->execute(map { $input->param($_) } ('city_name','city_zipcode'));
+ $sth=$dbh->prepare("INSERT INTO cities (city_name,city_zipcode) values (?,?)");
+ $sth->execute($input->param('city_name'),$input->param('city_zipcode'));
}
$sth->finish;
- print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=cities.pl\"></html>";
+ print $input->redirect("/cgi-bin/koha/admin/cities.pl");
exit;
# END $OP eq ADD_VALIDATE
################## DELETE_CONFIRM ##################################
# END $OP eq DELETE_CONFIRMED
} else { # DEFAULT
$template->param(else => 1);
- my $env;
my @loop;
- my ($count,$results)=StringSearch($env,$searchfield,'web');
+ my ($count,$results)=StringSearch($searchfield,'web');
my $toggle = 0;
for (my $i=0; $i < $count; $i++){
my %row = (cityid => $results->[$i]{'cityid'},
} #---- END $OP eq DEFAULT
-output_html_with_http_headers $input, $cookie, $template->output;
\ No newline at end of file
+output_html_with_http_headers $input, $cookie, $template->output;