Thanks for that unfortunately what you suggested didn't work. Although that is the practice I use in most cases. I found a work-around in the end by storing the variable in its own mysql table and then retrieving it again on the following page. Not the best way to do things I know, but it works now.
P.s. Its great to know you guys are there when we need a bit of help