dremes Posted November 5, 2009 Share Posted November 5, 2009 I have used the php below to show a different telephone number in the header of the site depending upon where the visitor comes from. The code below works but looses the original referrer information upon click of own site links, defaulting the telephone number back to the generic number. Is there away to save it to the session, maybe the start session and save session is not done correct? Thanks for any help ............................................................................. <?PHP session_start(); if(!isset($_SESSION[’referrer’])){ $referer = strtolower($_SERVER["HTTP_REFERER"]); if (strstr($referer,"site1")) { echo("<h1>Telephone Number1</h1>"); } else if (strstr($referer,"site2")) { echo("<h1>Telephone Number2</h1>"); } else if (strstr($referer,"site3")) { echo("<h1>Telephone Number3</h1>"); } else if (strstr($referer,"site4")) { echo("<h1>Telephone Number4</h1>"); } else { echo("<h1>Telephone Number5</h1>"); } $_SESSION[’referrer’] = $referrer; // store session data }?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.