From: ivan Date: Thu, 22 Apr 1999 04:33:05 +0000 (+0000) Subject: bugsquash X-Git-Url: http://git.freeside.biz/gitweb/?p=technostate.git;a=commitdiff_plain;h=c3c2bd39d9b8ddfc300550bb30f78e602862742e bugsquash --- diff --git a/cgi/persons.cgi b/cgi/persons.cgi index e062124..4733ccd 100755 --- a/cgi/persons.cgi +++ b/cgi/persons.cgi @@ -1,5 +1,5 @@ #!/usr/bin/perl -Tw -# $Id: persons.cgi,v 1.3 1999-04-22 04:27:47 ivan Exp $ +# $Id: persons.cgi,v 1.4 1999-04-22 04:33:05 ivan Exp $ # Copyright (c) 1999 Ivan Kohler. All rights reserved. # This program is free software; you can redistribute it and/or modify it under # the same terms as perl itself @@ -65,13 +65,18 @@ unless ( $cgi->param('magic') ) { #first time through &print_form( $cgi, "Add person" ); exit; } elsif ( $cgi->param('magic') eq 'process_form' ) { - foreach $field ( @fields ) { - if $cgi->param( $field ) - my $statement = 'INSERT INTO PERSONS ( ', - join(', ', @fields ), - ' ) VALUES ( ', - join( ', ', map { $cgi->param($_) } @fields ), + my $field; + foreach $field ( @fields ) { + if ( $cgi->param( $field ) ) { + $cgi->param( $field ) =~ /^(.*)$/; + $cgi->param( $field, $1); + } + } + my $statement = 'INSERT INTO PERSONS ( '. + join(', ', @fields ). + ' ) VALUES ( '. + join( ', ', map { $cgi->param($_) } @fields ). ' )' ; my $sth = $dbh->prepare($statement)