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? Quote 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? Quote 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 Quote 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 Quote 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 Quote 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 Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.