Now we need a file that will simply set a
cookie to the user's preferred style.
<?php
$Year =31536000 + time();
setcookie ('style', $choice, $year);
header("Location: $HTTP_REFERER");
?>
You can save this code as anything you want, in our example we'll assume you called it changestyle.php. Now to actually change the style all you need to do is pass the
$choice variable along to this script. It will then place a style cookie that lasts one year into their browser, and then redirect them back to the referring page.