Gossamer Forum
Home : General : Perl Programming :

Calling a cgi script inside another cgi script passing variables

Quote Reply
Calling a cgi script inside another cgi script passing variables
I have read many posts about this but have so far been unable to get my script to call another of my scripts passing variables along with it

NOTE: Both my scripts are in the same directory on the same server



(ScriptA.cgi)

#!/usr/local/bin/perl

print "Content-type: text/html\n\n";

#GET QUERY ATTRIBUTES
$source = $ENV{'QUERY_STRING'};
@pairs = split(/&/, $source);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%(..)/pack("c", hex($1))/eg;
$SOURCE{$name} = $value;
print "name- $name = $value <BR>"; #DEBUG
}

local ($page) = "";

$SubPage = "ScriptB.cgi?LoginId=$FORM{'LoginId'}&Password=$FORM{'Password'}";

$OutPut = qx|perl $SubPage|;

$page = $page . $OutPut;

print $page;



(ScriptB.cgi)

#!/usr/local/bin/perl

print "Content-type: text/html\n\n";

$test = $ENV{'QUERY_STRING'};

@pairs = split(/&/, $test);

foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%(..)/pack("c", hex($1))/eg;

$FORM{$name} = $value;
print "name- $name = $value <BR>"; #debug
}




NOTE: I need these to be in separate scripts

Any help would be greatly appreciated

Cheers

Jeff
Subject Author Views Date
Thread Calling a cgi script inside another cgi script passing variables encino 6299 May 28, 2003, 8:46 PM
Thread Re: [encino] Calling a cgi script inside another cgi script passing variables
Paul 6190 May 29, 2003, 2:26 AM
Thread Re: [Paul] Calling a cgi script inside another cgi script passing variables
encino 6138 May 29, 2003, 5:10 PM
Thread Re: [encino] Calling a cgi script inside another cgi script passing variables
Paul 6183 May 29, 2003, 5:18 PM
Post Post deleted by encino
encino 6082 May 29, 2003, 5:53 PM
Post Re: [Paul] Calling a cgi script inside another cgi script passing variables
encino 6100 May 29, 2003, 7:19 PM