Current URL

$_SERVER[‘HTTP_REFERER’] shows the previous URL.
$_SERVER[“SERVER_NAME”] shows the current domain.

Then, what shows current URL?

You should be able to extract it from $_SERVER[‘PATH_INFO’]
http://php.net/manual/en/reserved.variables.server.php

$_server[‘request_uri’].

to see all the $_SERVER array elements and values, you can run this simple loop to display them on the screen

 
<?php
 
foreach($_SERVER as $key => $value) {
 
    echo $key. ' = '.$value.'<br />';
 
}
 
?>

Then, what shows current URL?

there’s a couple there you can use. one is $_SERVER[‘PHP_SELF’]

A combination of $_SERVER[‘HTTP_HOST’] and $_SERVER[‘REQUEST_URI’]