ballhogjoni Posted January 24, 2008 Share Posted January 24, 2008 Say I am at http://test.com/index.php how can I echo this exact url into my page? Link to comment https://forums.phpfreaks.com/topic/87642-solved-how-can-i-echo-the-url-into-my-page/ Share on other sites More sharing options...
revraz Posted January 24, 2008 Share Posted January 24, 2008 PHP_SELF? Link to comment https://forums.phpfreaks.com/topic/87642-solved-how-can-i-echo-the-url-into-my-page/#findComment-448255 Share on other sites More sharing options...
jorgep Posted January 24, 2008 Share Posted January 24, 2008 echo $_SERVER['PHP_SELF']; In this site you can find more: http://us.php.net/reserved.variables Link to comment https://forums.phpfreaks.com/topic/87642-solved-how-can-i-echo-the-url-into-my-page/#findComment-448265 Share on other sites More sharing options...
kenrbnsn Posted January 24, 2008 Share Posted January 24, 2008 Has anyone who has suggested using $_SERVER['PHP_SELF'] tried it? It will not be what the OP is looking for. To get that string you have to use a combination like: <?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '/'; ?> Ken Link to comment https://forums.phpfreaks.com/topic/87642-solved-how-can-i-echo-the-url-into-my-page/#findComment-448270 Share on other sites More sharing options...
jorgep Posted January 24, 2008 Share Posted January 24, 2008 I sent the documentation web site so he can find out hehe Link to comment https://forums.phpfreaks.com/topic/87642-solved-how-can-i-echo-the-url-into-my-page/#findComment-448279 Share on other sites More sharing options...
revraz Posted January 24, 2008 Share Posted January 24, 2008 It's no fun giving the exact answer, it's more fun to point them in the right direction and let them figure it out. Has anyone who has suggested using $_SERVER['PHP_SELF'] tried it? It will not be what the OP is looking for. To get that string you have to use a combination like: <?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '/'; ?> Ken Link to comment https://forums.phpfreaks.com/topic/87642-solved-how-can-i-echo-the-url-into-my-page/#findComment-448291 Share on other sites More sharing options...
ballhogjoni Posted January 25, 2008 Author Share Posted January 25, 2008 Thsank, I tried the php.net site but it didn't answer my question. thats why I asked on the forum. Link to comment https://forums.phpfreaks.com/topic/87642-solved-how-can-i-echo-the-url-into-my-page/#findComment-448629 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.