Jump to content

Recommended Posts

Hi all,

 

I can't believe how awkward this is. I've a send to friend link on a page:

echo '<a href="send_to_friend.php" onClick="return popup(this, \'send_to_friend\')"
><img src="images/envelope.jpg" width="30" height="30" alt="send to friend" border="0"/></a>';

This then opens up a new window with a simple form - your name, friends name and email and comments.

What I want to do is add the original page URL into the email.

 

This is a dynamic site so the url could be www.mydomain.com/article.php?id=7

 

So I've added the above to my article.php page. All I need to do is pass the effectively dynamic URL through to the send_to_friend.php script.

I've tried:

$ref = getenv("HTTP_REFERER");

$referer = $_SERVER['HTTP_REFERER'];

$ref=@$HTTP_REFERER;

To no avail

 

Any help much appreciated!

you should be able to generate what ur after wiv this :)

 

$pagename  = $_SERVER["SCRIPT_NAME"];

$pagename  = substr($pagename,strrpos($pagename,'/'),strlen($pagename));

$pagename  = str_replace("/", "", $pagename);

 

in order to pull out the dynamic content ur script must allready be pulling from a variable which u could tag onto the end of your href like this :

 

<a href='$pagename?var=$dynamic_var'></a>

 

hope this helps :)

Thanks scooby545 although I don't thin that would do what I'm after!

 

Effectively, I'm on a page such as www.mydomain.com/article.php?id=7 or www.mydomain.com/article.php?id=77

 

This is a single script - article.php which calls in the relevant info depending on the id. On that page is a link, say send to friend:

echo '<a href="send_to_friend.php" onClick="return popup(this, \'send_to_friend\')">Send to friend</a>';

If they click the link, a pop up window opens which is now running send_to_friend.php. What I need to do, is pass www.mydomain.com/article.php?id=7 or www.mydomain.com/article.php?id=77 to that script and include it in the email.

 

Hope that makes a bit more sense?

 

Thanks

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.