http://localhost:8080/myfolder/hostname.php
1 2 3 4 5 6 |
<?php $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; echo $url; ?> |
To send url of page hidden to collect in next page use this code below: –
localhost:8080/myfolder/hostname.php
1 2 3 4 5 6 |
<?php $url=$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?> <input type="hidden" name="pageurl" value="<?php echo $url ?>"> |
Remember to collect on the other side
http://localhost:8080
1 2 3 |
$url="http://".$_SERVER['HTTP_HOST']; |
and for just the actual pagename
index2.php
1 2 3 |
$justpagename = basename($_SERVER['SCRIPT_NAME']); |
and for the previous pages page name only
clickme.php
1 2 3 |
echo $url=basename($_SERVER['HTTP_REFERER']); |