 
<form method="post" action="reflect.php">
  Email: <input name="email" type="text" /><br>
  Message:<br>
  <textarea name="message" rows="15" cols="40">
  </textarea><br>
  Link: <input name='link', type='text' /><br>
  <input type="submit" />
</form>

<?php
ob_start();
$val = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
echo $val;
setcookie("user",$val, time()+3600), "/tests/", ".danmcinerney.org");
ob_end_flush();
?>
<a href='http://danmcinerney.org/tests/uaref.php'>ua and ref</a>


</body>
</html>