[ back to toc ]

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

Date: 2002/05/21 11:07

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
Q:
Thanks Peter.

For a clear picture of what I am trying to accomplish, please go to:
http://masteraffiliate.com and look at the right frame starting with "When
you join ...".

This is an HTML page within a frame. If you click on one of the names,
you'll see a list of eBooks. Since this is a replicating page, I am
trying to replace the URL for each book to the member's personal URL for
each of these books.

Do I understand correctly from your answer that the only way to do this is
to change this frame to a CGI script to replace the variables?

I am not a programmer, but I can usually fumble around until I get
something to work. Thanks for your help.

*NAME-DELETED*

A:
>>>
Do I understand correctly from your answer that the only way to do this is
to change this frame to a CGI script to replace the variables?
<<<

No, that is not the only way. That is one possible way. Another possible
way is to include some JavaScript in the page that uses the 'cgi
variables' from the URL and alter the page whil it downloads to include
the actual parameters.

Unfortunately I am not an expert in JavaScript so I can not help you
answering the how. I could though but it would take too much time and it
is more economic if you ask here a JavaScript expert on the details.

Regards,
Peter

[ back to toc ]