in reply to CGI and HTML form

Instead of javascript, you could just put the buttons in separate <form> tags so they have different actions. (Why no javascript?)
<form action="prog1.cgi"> ... <input type="submit" value="View"> </form> <hr> <form action="prog2.cgi"> ... <input type="submit" value="Edit"> </form>

If you want to do it strictly on the backend, a couple thoughts come to mind. First is that the script you submit to simply looks at the button value and then does a redirect to the appropriate .cgi url (constructing a query string of course so values are preserved). Take a look at CGI, specificall the param() and redirect methods.

Second backend way (and probably better) is that you just have one cgi file, but it (depending on the button value) calls code from different files (different "include" files or modules). Take a look in the Tutorials section for basics on modules and Including files.
my $btn = $q->param('button'); if( $btn eq 'viewBtn' ){ ... }elsif( $btn eq 'editBtn' ){ ... }else{ ... }

Replies are listed 'Best First'.
Re^2: CGI and HTML form
by ww (Archbishop) on Jun 14, 2005 at 14:41 UTC
    re "why no js?" -- accessibility issues: NYS website rules, for example, effectively make use of .js a non_starter, as rules require that sites must provide users of lynx (or other non-js website visitor) an "equivalent experience" which (in part because of other parameters) translates to "maintain a parallel, text_only site;" do all (potentially js) work on the server-side; or violate the rule.