With the help of people in this forum I've got it working. Below I've described how it works.
Basically I pass the session id round from page to page, instead of depending on cookies. This still uses the php standard sessions, which handles registering variable and the serialisation that is necessary. So the bits of the code are as follows
if(isSet($_GET['SID']))
{
$sid = $_GET['SID'];
}
else
{
$sid = "";
}
session_start($sid);
$sid = session_id();
and on the web page
<a href="test1.php?SID=<?php echo $sid; ?>">Back</a>
The example uses GET, but of course the same mechanism would work with POST. All that matters is that session_start() has the previous sid.
If anyone needs any further information, let me know. Thanks to all who helped.