bugsquash
authorivan <ivan>
Thu, 22 Apr 1999 04:33:05 +0000 (04:33 +0000)
committerivan <ivan>
Thu, 22 Apr 1999 04:33:05 +0000 (04:33 +0000)
cgi/persons.cgi

index e062124..4733ccd 100755 (executable)
@@ -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)