[ back to toc ]

How to Pull Variables Created by CGI Script to HTML Page???

Date: 2002/05/20 10:12

Q:
I have a CGI-Based script that generates variables used throughout the
program.

I'm trying to figure out how to pass those variables to an HTML page. A
portion of the script is as follows:

_______________________________________________
#!/usr/bin/perl

$lib="../lib";
require "$lib/config.pl";
# Pull in required libraries
require "$lib/dbmember.pl";
require "$lib/dbcompany.pl";
require "$lib/ez_html.pl";
require "$lib/web_basic.pl";
# Global variables
# Read in form data
%in=&Get_Form_Data;
# Validate login
&OpenMemberDB;
&Login;
&OpenCompanyDB;
%fields = &LoadMember( $in{'login key'} );
%sponsor_fields = &LoadMember( $fields{'parent'} );

foreach $traffic_prog (keys %def_tkey)
{
$sponsor_fields{$traffic_prog}=$def_tkey{$traffic_prog}
unless $sponsor_fields{$traffic_prog};
}
_________________________________________________

This code is from a CGI script that launches an HTML page. My goal is to
use the $sponsor_fields{$traffic_prog} variable in the called HTML page as
follows:

http://www.FreeViral.com/?r=$sponsor_fields{$traffic_prog}

How can I do this?

Thanks for the help.

*NAME-DELETED* *NAME-DELETED*

p.s. The script is a modified version of the "LifeStyleNetworker Special
Edition" and my site is on ThirdSphereHosting.
A:
It is a bit hard to answer, because I do not really understand what you
intend to do. A CGI script can not launch an HTML page. What is more: an
HTML page can not be launched. An HTML page is just a bunch of characters
which are not executed unlike a CGI script and thus can not be launched.

A CGI script can print out as a response to the browser an HTML page on
the CGI script standard output. In such a situation the CGI script should
use the Perl variables to print them at appropriate location in the answer
HTML page.

A CGI program can send a redirect response to an URL that may optionally
contain arguments (sloppy called CGI parameters), like '?a=1' In such a
situation the CGI script should include the actual value of the variables
in the URL.

Regards,
Peter

[ back to toc ]