package Invtot::Controller::Invtot; use Mojo::Base 'Mojolicious::Controller'; sub post { my $c = shift; my $p = $c->req->body_params->to_hash; #gets the form values my $for_abo = $p->{'ccabo'} // '' eq 'ABO' ? 1 : 0; my $reqVal = $p->{'ZLField'}; .... #build the sql string $sql{$key} = format_sql( $reqVal, $p->{ZLMode}, $for_abo ); #get the values from the db my $stm = $c->db->prepare_cached( $sql{$key} ) $stm->execute($toFind) or die $stm->errstr; $c->stash( stm => $stm, for_abo => $for_abo ); } #build the page with the db values $c->render('invtot'); } ... 1;