Gossamer Forum
Home : General : Perl Programming :

copy current URL into variable (on IIS)

Quote Reply
copy current URL into variable (on IIS)
Hey guys,

nice place you got here Wink just found it.

I was wondering is there any way to copy the current url into a variable so I can use it later on other pages? It would be used for something like a "return to the last page" link - My script passes alot of pairs through the url bar eg:
/cgi-bin/script.pl?var1=something&var2=somethingelse... etc

I have tried tried using $ENV{'SCRIPT_NAME'} but it just returns the url to the script and none of the vars.
I think in php you can use $PHP_SELF so I am looking for sometrhing like that, I am on IIS 5 and ActivePerl

Thanks very much Smile

Kenny
Quote Reply
Re: [Jacobyte] copy current URL into variable (on IIS) In reply to
Try $ENV{REQUEST_URI}
Quote Reply
Re: [Paul] copy current URL into variable (on IIS) In reply to
cheers for that

I am on a couple of IIS servers though and that ENV variable is not present on any of them

is there any other method?

thanks again.
Quote Reply
Re: [Jacobyte] copy current URL into variable (on IIS) In reply to
$ENV{QUERY_STRING} ?
$ENV{PATH_TRANSLATED}

Not sure about the second one...I can't remeber what exactly it outputs.

Try printing them all to see....


print map { "$_ => $ENV{$_}\n" } keys %ENV;

Last edited by:

Paul: Jun 12, 2002, 8:51 AM
Quote Reply
Re: [Paul] copy current URL into variable (on IIS) In reply to
ahhh thats the one '$ENV{QUERY_STRING}'

remember seeing it a while ago but had completely forgot about it.

I've managed to get a complete link now by
using:

$rtnlink = $ENV{SCRIPT_NAME}."?".$ENV{QUERY_STRING};

Thanks very much for your help Paul, greatly appreciated - cheers Smile