Jump to content

need help to grab URL


pixeltrace

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

Archived

This topic is now archived and is closed to further replies.



×
×
  • 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.