What is the difference between $_SERVER["REQUEST_URI"] and $_SERVER["HTTP_REFERER"] in PHP?

$_SERVER["REQUEST_URI"] contains the URI of the current request, including query parameters, while $_SERVER["HTTP_REFERER"] contains the URL of the previous page that linked to the current page. If you need to get the current page's URL, use $_SERVER["REQUEST_URI"]. If you need to track the referring page, use $_SERVER["HTTP_REFERER"]. It's important to note that $_SERVER["HTTP_REFERER"] may not always be set as it relies on the client sending this information.

$current_page_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$referring_page = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'No referring page';