Jump to content

Recommended Posts

Hi,

 

i need help.

 

i have a link "send to a friend" where in if i click it,

it will pop up a new window and will supposed to be grabbing the URL of that page

 

what is the code for me to add in my "send to a friend" button so i can grab the URL

of that page and send it in the pop up form?

 

currently this is the code that i  have for my "send to a friend" button

 

<a href='javascript:void(0)' onclick="window.open('index2.php?option=com_content&task=emailform&id=18&subjectline=Mumcentre%20Online%20Forum&customurl=option%3Dcom_simpleboard','win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,resizable=yes,width=540,height=440,directories=no,location=no');"'><img src="images/M_images/sendafriend2.png" alt="Send To A Friend" name="Print"  height="19" border="0" align="middle" /></a>

 

 

what code will i use for this part

index2.php?option=com_content&task=emailform&id=18

 

so it will automatically grab whatever the current url is?

 

hope you could help me with this.

 

thanks!

 

 

Link to comment
https://forums.phpfreaks.com/topic/61778-need-help-to-grab-url/
Share on other sites

try this code and link. the code below sets the variable $url to 'index2.php'. if there are any parameters on that page (option, task, id, etc..) it will add them to the url.

 

$url = "index.2.php";

  if (isset($_SERVER['QUERY_STRING'])) {

    $url .= (strpos($url, '?')) ? "&" : "?";

    $url .= $_SERVER['QUERY_STRING'];

  }

 

<a href='javascript:void(0)' onclick="window.open('<?php echo $url; ?>','win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,resizable=yes,width=540,height=440,directories=no,location=no');"'><img src="images/M_images/sendafriend2.png" alt="Send To A Friend" name="Print"  height="19" border="0" align="middle" /></a>

Link to comment
https://forums.phpfreaks.com/topic/61778-need-help-to-grab-url/#findComment-307608
Share on other sites

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.