Well, to find out whereever they had clicked you could use a tracking database and then create a simple output page with the results.
Basically just
if ($submit) {
something here to change\add to database
}
For cookies its so simple you don't need a tutorial, just a few points.
Cookies have to be set before any output, this INCLUDES white lines, for example
<?php
setcookie ()
?> works, but...
<?php
setcookie()
?> doesn't work.
The variable as above is setcookie()
The values are in '' (not for time) with , between them and are cookiename, cookievalue, time. For more complex examples more may be needed but I can't name any specific pages. If you have a more specific question try using the search on the left, so many questions have already been asked if may have been covered which is obviously a faster way of getting answers.
Before an example...
"Would I have to insert the cookie script in EVERY web file though so that every page would be accounted for?"
As far as I understand this, no. Once you set a cookie its available everywhere, unless you set limits to the web sites it can be used on set after the time value.
Example using a 1hour time cookie called general with the value test working in the example directory only. (PHP3, doubt PHP4 is different) Cookies is set if the name "User" is entered.
<?php
if ($user == "User") {
setcookie ('general','test',time()+3600,'/example/');
?>
<form action="<?php echo($PHP_SELF); ?>" method=post>
<table border="0" cellspacing="0" cellborder="0">
<TR><TD bgcolor=fd4d1f9">User User</TD><TD><INPUT TYPE="text" NAME="user" SIZE="20" MAXLENGTH="30"></TD>
</table>
<br>
<input type=submit name="submit" value="submit">
</form>
Note that the form is written AFTER the setcookie
Hope that helps.