Thank you both very much for the quick replies, which have given me hope
Here's my calculator (hyperfocal.php) ...
<?php
$f = $_GET['focalLength'];
$N = $_GET['aperture'];
$c = $_GET['sensor'];
$unit = $_GET['unit'];
// Set the Cookie here ?
$H = hyperfocal_distance($f, $N, $c, $unit);
$unitstr = "Meters";
if (strtoupper($unit) == "F") $unitstr="Feet";
// Send the result back
echo $H . " " . $unitstr ;
function hyperfocal_distance($f, $N, $c, $unit) {
$div = 1000;
if (strtoupper($unit) == "F") $div = 304.8;
return round(((pow($f, 2) / ($N * $c)) + $f)/$div, 1, PHP_ROUND_HALF_UP);
}
?>
Are you saying that I can set the Cookie as soon as I've retrieved the options from the querystring?