my $submit = param( 'logbtn' ); if ( $submit eq 'Insert' ) { # insert into database here } else { # display form here }