--- Timothy Kimball <[EMAIL PROTECTED]> wrote:
>
> : I have a formular with 3 text input fields ( name, fullname, and
> street )
> : and 2 submit buttons.The first submit button start a perl-script
> "work.pl"
> : and the second submit button start an another perl-script
> "checkup.pl"
> : Now, I don't know, how to make one formular with 2 submit buttons,
> which
> : the first submit button start the script work.pl and the another
> button
> : start the script checkup.pl.
>
> Forms in an HTML page are separate from each other, and you'd need
> Javascript to make the input fields from one form available to
> another
> on the same page.
>
> Since Javascript is a pain, I would recommend a Perl solution. ;)
> Instead of two scripts, just have one. And bind the submit buttons
> to a CGI parameter, something like this:
>
> <input type="submit" name="submit_action" value="Checkup">
> <input type="submit" name="submit_action" value="Work">
>
> Then have the script check the value of the submit_action parameter.
> If it's "Checkup", do whatever checkup.pl does; if it's "Work", do
> what
> work.pl does.
>
> This does mean combining two small scripts into one larger one, so
> make
> sure you do "use strict;" so you don't get messed up with a global
> variable somewhere. I write CGI scripts like this all the time with
> several views and about a dozen submit actions, and it works out
> fine.
> (Who said Perl doesn't scale? ;)
>
Alternately, just have both buttons call one script which passes
control to the correct script based on the parameter.
# get the parameter, then do something like this:
if ("Checkup" eq $val) { do $checkup; }
if ("Work" eq $val) { do $work; }
You'd probably want to add some more error checking....
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/