I have a dynamically generated website that needs for a phone number (include file) to change depending on which page they entered on. These pages are clones of the index.php page, but seperated into their own folder, so URL can be used in seperate magazine ads and are easily distinguishable.
http://www.francoisandco.com/
http://www.francoisandco.com/ad/
http://www.francoisandco.com/elle/
http://www.francoisandco.com/fd/
http://www.francoisandco.com/ch/
etc.
Each page will have a unique phone number at the top of the page. Once they enter, through one of these advertised URLs, any link will send them back into the main content area.
What I'm trying to accomplish is for the browser to recognize where they entered (....andco.com/ad/ or ....andco.com/elle/) and use that information to tell the main page which phone number to display.
Using the following code on the main index.php page accomplishes this, but only on the initial click from the entrance page.
if(getenv('HTTP_REFERER') == "http://www.francoisandco.com/ad/") { $phone = "AD"; }
if(!isset($phone)) $phone="main";
and using the following in the include file:
<img src="/images/phoneNumber-<? echo $phone; ?>.jpg" width="250" height="60" border="0" alt="Call Today!">
And then creating seperate phone number images with associated names (phoneNumber-AD.jpg, phoneNumber-ELLE.jpg, etc.).
Anyway, since the refering page changes on the next click, this reverts back to the "main" phone number, but I need the phone number to remain associated with the page they entered on. So I'm thinking Cookies and/or Sessions would be a solution, but have not used them before so not sure how to set this up.
Sorry for the drawn out explanation, but thought it might help.
Any initial thoughts on using Cookies and/or Sessions to accomplish this? Any threads or tutorials that might help?
Many thanks!!