Forum Moderators: coopster & phranque

Message Too Old, No Replies

Getting the Current URL

Email a Friend this page project

         

rumple

3:18 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



Hello,

I need to get the current url (the url the "email a friend" form is submitted from) so I can put it into an email, that's... mailed to a friend.

The script is actually one I'm modifying that currently works when sending the referrer page (previous page visited) in the email, but this requires going to a separate page with the form on it to work, which I'd rather not require. I want the form on every page.

Thanks in advance.

bob742

3:45 pm on Dec 19, 2003 (gmt 0)

10+ Year Member



check out the %ENV hash array.

$ENV{'REQUEST_URI'} is one bit of it. I think you may need to concatinate two variables to get the full URL.

Bob

alexwilli

4:00 pm on Dec 24, 2003 (gmt 0)

10+ Year Member



Another option is to use javascript and pass in the URL as a variable.

i.e. something like
'/cgi-bin/test.pl&ref_url=' + location.href

Chico_Loco

4:12 am on Jan 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One thing I used to do in the first "refer a friend" script I did was have a link to the cgi / perl script on each page, then in the perl script, use $ENV{'HTTP_REFERER'}. It will detect the page you just came from.