First of all, don't cross-post please. One list is quite sufficient, and
many people are subscribed to more than one list, so duplicate messages
are quite often completely ignored.

> I've got a cgi form that takes in data.  Then, I want the 
> data to be passed to a script that's waiting on a DIFFERENT host.
> 
> So, say I have this pseudo-code:
> 
> cgi script on host 1    pass $name to host 2          script on host 2
> # get $name             --------------------------->  print 
> "hi there $name!\n";

Could you pass $name in the query string? Like this:

 --script 1--
 #!/usr/bin/perl -w
 use strict;
 use CGI;
 my $cgi = new CGI;

 my %F = ();
 # get all values passed to this script
 # assuming no multi-valued form elements
 $F{$_} = $cgi->param($_) for $cgi->param();

 # rebuild the query string to stick on the
 # end of whatever script you want to send
 # these values to
 my $query_string = '?';
 $query_string .= "$_=$F{$_}\&" for keys %F;

 my $host2 = 'http://www.host2.com/script.cgi';
 print "Location:$host2$query_string\n\n";
 --end script 1--


 --script 2--
 #!/usr/bin/perl -w
 use strict;
 use CGI;
 my $cgi = new CGI;

 my %F = ();
 # get all values passed to this script
 # assuming no multi-valued form elements
 $F{$_} = $cgi->param($_) for $cgi->param();

 # print them to make sure they're there
 print '<pre>';
 print "\$F{$_} == $F{$_}\n" for keys %F;
 print '</pre>';

 # do stuff with the values passed to the first script
 --end script 2--

HTH,

 -dave



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to