Search code examples
phpjavascriptreferrer

how do I assign page referrer to a php variable


I am using javascript to get the referring page (document.referrer) which works fine and I can add this value to a div no problem.

How do I assign this value to a PHP variable in order to do some other things with it?

Ideally, something like:

$myphpvariable  = document.referrer;

Solution

  • what about

    $myphpvariable = $_SERVER['HTTP_REFERRER'];
    

    ?