How can you determine the referring page in PHP?

To determine the referring page in PHP, you can use the $_SERVER['HTTP_REFERER'] variable. This variable contains the URL of the page that referred the current page. You can check if this variable is set and then use it to display or process the referring page.

if(isset($_SERVER['HTTP_REFERER'])) {
    $referringPage = $_SERVER['HTTP_REFERER'];
    echo "Referring Page: " . $referringPage;
} else {
    echo "No referring page found.";
}