'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'

Post by Jim_Bo »

Hi,

I am sending the code below to popup window using javascript..

Code: Select all

./tellafriend.php?url=http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'"
which generates a link looking like:

Code: Select all

http://www.domain.com/tellafriend.php?u ... itemid=111
When I use $_GET['url'] to retreive the variable, everything from the & symbol is missing..

How can I get around that?

Thanks
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: '.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'

Post by requinix »

Use urlencode on the URL.

Code: Select all

"./tellafriend.php?url=" . urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])

Code: Select all

http://www.domain.com/tellafriend.php?url=http%3A%2F%2Fwww.domain.com%2Fshop.php%3Faction%3Ditem%26itemid%3D111
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

Re: '.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'

Post by Jim_Bo »

Thats the trick..

Thanks
Post Reply