Reputation: 209
I have this URL lets say:
www.abc.com/item?id=10
When ever I do this:
echo $_SERVER['PHP_SELF']
I get only:
www.abc.com
How do I get the whole URL with appended variable?
Upvotes: 1
Views: 1274
Reputation: 1147
use $_SERVER['REQUEST_URI']
as follows
echo "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
/* Or */
echo $_SERVER['REQUEST_SCHEME']."://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
Upvotes: 0
Reputation: 3345
You can try to take the full URL with: (for example)
<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>
Good topics:
Upvotes: 0