For anyone who is interested:
To store an array in a cookie:
<?
// create the array
$myarray = array();
// store values in the array
$myarray[value1] = $value1;
$myarray[value2] = $value2;
// ...
// serialize and urlencode the array
$serialized = serialize($myarray);
$urlencoded = urlencode($serialized);
// set the cookie
setcookie("mycookie", $urlencoded, time()+3600);
?>
To retrieve the array from the cookie:
<?
// urldecode and unserialize cookie value
$urldecoded = urldecode($mycookie);
$unserialized = unserialize($urldecoded);
// extract values from the array
echo "value1=$unserialized[value1]<br>";
echo "value2=$unserialized[value2]<br>";
// ...
?>
With many thanks to JBL, who put me on the right track (coming from Perl, one gets confused a little with vars in PHP 😉
Steven