global $fref; if ($_GET['fref']=='PS') $_SESSION['fref']='PS'; $fref = 'foo';
<a href="$fref">XXXXXXXXXXXXXX</a>