Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Multiple Scripts?

by swiftone (Curate)
on Nov 14, 2000 at 22:51 UTC ( #41616=note: print w/replies, xml ) Need Help??


in reply to Multiple Scripts?

I'm not sure I understand why you have multiple scripts at all. If you're taking the same kind of data, and doing the same kind of manipulation on it, why not fill out one form, which goes to one script, that does the calculations on the data sent?

Update: To try to answer your question though, calling a CGI script from another is usually fairly messy, because you have to make sure the parameters are sent correctly (don't forget it's the Webserver that interprets the ?blah=blah as QUERY_STRING, not the script). You can do a redirect via CGI.pm to do it, or make your scripts non-CGI, otherwise it's more trouble than it's worth.

Update2: jptxs provides a great example of redirects below. Be sure your form data is passed along in URL protected fashion (perhaps using URI::Escape?)

Replies are listed 'Best First'.
RE: Re: Multiple Scripts?
by ImpalaSS (Monk) on Nov 14, 2000 at 22:59 UTC
    Hey guys, I wish i could show you the html, but the nextel servers wont let any ip's except 176.16.*.* in.. so let me try and elaborate.
    Well, there are 2 seperate scrips. One computes the data for any given day, EXCEPT today, and the other script computes the data for today only.
    The problem is, when the form is printed, the drop down box with the site names, is about 1000 entries long, and that prints 2 times, once for the today script, and the other for the date script.
    What i can do, is paste the paramters:
    For the Today Script:
    http://172.16.4.25/cgi-bin/stats-cgi/today.pl?netid=0002-1&market=PHL

    For the Anydate Script:
    http://172.16.4.25/cgi-bin/stats-cgi/pickaday.pl?date=14Nov00&netid=0002-1&market=PHL

    If i do do the radio button way, can i have it, so when the button is active, the form points to one script, and if it is unchecked, the form points to another?
    basically what he wants is the one field, instead of being printed twice, for each script, its printed once, and based on what date is picked, it goes to the correct script?

    Thanks In Advance
    Dipul
      If i do do the radio button way, can i have it, so when the button is active, the form points to one script, and if it is unchecked, the form points to another? basically what he wants is the one field, instead of being printed twice, for each script, its printed once, and based on what date is picked, it goes to the correct script?

      Not without Javascript (and don't go there).

      So the solution is to either use what jptxs provided (but make sure you pass along your $ENV{QUERY_STRING} tacked on), or to make your two scripts non-CGI. Make them subroutines or Modules, and require/use them in the one CGI script that gets the form data.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (1)
As of 2023-05-28 03:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?