How to use a session variable globally
-
Hi,
i want to use an incoming id, for example:
https://www.wordpressdomain.com/category/title.html?id=123I safe it in the index.php to a session variable, for example:
<?php session_start()?>
<?php $_SESSION["sub_id"] = $_GET["id"];?>
On every other php file of my template, i include
<?php session_start()?>
Then i want to pass the id over to an external link like this:
https://www.externaldomain.com/10362533?SID=<?=$_SESSION["sub_id"]?>
HERE COMES MY PROBLEM:
Everything is working, UNLESS the user is landing on my blog AND surfing around before she clicks on my link for the external domain!
So my question is:
Where to implement the session-stuff (which files) so that wordpress handles my session all the time the user stays on my page?
I seem to lose the variable somewhere on the way when the user surfs my site…Any ideas?
Thanks,
Hans
- The topic ‘How to use a session variable globally’ is closed to new replies.