Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Call CGI script from another CGI script

by ifubiok (Initiate)
on Feb 26, 2006 at 21:14 UTC ( #532920=perlquestion: print w/replies, xml ) Need Help??

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.



    --chargrill
    $/ = 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="script.pl" 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://532920]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2023-10-02 08:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?