Question : forms and cgi - calling a subroutine rather than separate cgi script

I have a cgi script within which I want to create a html form rather than have a separate html document. How do I get that form to call a subroutine in the same script.

For example if I had a subroutine called 'processForm' would I write the following

<form action="processForm()"   etc etc </form>

Thanks a lot!

Answer : forms and cgi - calling a subroutine rather than separate cgi script

No but you can do something like this...

<form action="script.pl"
<hidden name="screen" value="entry"/>
...
</form>

Then in your perl file, you have something at the top like this:

my $q = CGI->new;
my $screen = $q->param('screen');
if ($screen eq 'entry') {
    processForm();
} elsif ($screen eq 'something_else') {
    someOtherSub();
} else {
    startPage();
}
Random Solutions  
 
programming4us programming4us