how does "recent history" work on sites for php? (PHP)
<p>I'm not sure if there is an explanation on SO for beginners, but if so, could you provide the links. </p>

<p>I am interested in creating a "recent viewed" function that shows what links they clicked on before.
I'm not sure if this is the 'correct' way to do it, but this is what I have so far...</p>

<ol>
<li>user clicks on a link(say ad.php?posting_id=12).</li>
<li>when the user clicks on the link, it sets a cookie for $_cookie['ad.php?posting_id=22']</li>
<li>Each time the user clicks, more cookies are set</li>
<li>In the recent viewed function, it gets all the $_cookie variables and displays them.</li>
<li>if the user wants to clear the history, just destroy all the cookies</li>
</ol>

<p>I'm not sure if this is the way to do it, but is the viable?
If not, what are the steps to create a "recent viewed" function</p>
