pixeltrace Posted July 26, 2007 Share Posted July 26, 2007 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 More sharing options...
flyerball10 Posted July 26, 2007 Share Posted July 26, 2007 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 More sharing options...
pixeltrace Posted July 26, 2007 Author Share Posted July 26, 2007 but what if let say i am in http://www.yahoo.com or http://www.google.com? and i want to automatically grab the current URL for the $url? hope you could help me with this. thanks! Link to comment https://forums.phpfreaks.com/topic/61778-need-help-to-grab-url/#findComment-307662 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.