ifubiok has asked for the wisdom of the Perl Monks concerning the following question:

I have a CGI script on my website that I want to use to send the visitor to one of several other scripts depending on the form variables. I want to send the form variables from the original script to the new script. What are the methods available to perform this?
  • Comment on Call CGI script from another CGI script

Replies are listed 'Best First'.
Re: Call CGI script from another CGI script
by chargrill (Parson) on Feb 26, 2006 at 22:08 UTC

    Am I missing something? In cgi1.cgi, have it generate the following HTML:

    <form action="cgi2.cgi">

    There are several ways to accomplish that, from:

    print "<form action=\"cgi2.cgi\">\n";

    ... to ...

    use CGI qw/:standard/; # ... print start_form( -action=>'cgi2.cgi' );

    But I won't presume to guess what style you're following. With a careful read of the appropriate documentation, I'm sure you can decide which route to take.

    $/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );
Re: Call CGI script from another CGI script
by talexb (Chancellor) on Feb 27, 2006 at 01:58 UTC

    Can't you just re-direct from one CGI to another?

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Re: Call CGI script from another CGI script
by mbadolato (Hermit) on Feb 27, 2006 at 03:50 UTC
    Not really a Perl question, but why not just use Javascript to change the action="" desitination, based on the form field variables?

    So, for instance, an onChange for a drop-down would call a JavaScript routine that would determine what to change the action to, then when the user hits submit, the script that the form gets sent to, form fields and all, is the one you need to happen.