Given a certain url, custom = www.namesite/r=namerefferrer
to initialize a $_SESSION
and retrieve the value of this $_SESSION
I did:
I set this in functions.php:
if (!session_id()) {
session_start();
if($_GET['r']){
$_SESSION['referrer']=$_GET['r'];
}
}
in my front-page.php;
<?php
$rp = $_SESSION['referrer'];
echo $rp;
?>
but it does not recover anything unless I modify the url by adding a? after the /, like this:
www.namesite/?r=namerefferrer
how to recover the session and show it without ?