title: Check when page changed
body: <p>I'm new here, also a novice programmer, and not really familiar with PHP. I don't even know the name of some of the techniques I used when building my apps. I'm sorry for that, but I'll try to explain the best I can.</p>
  
  <p>So I'm building a web apps with PHP / AJAX right now, and I've got to the point where some users (with their own privilege) have their own home page, which shows notification for them when something new happened in the system. I think I used the "get" method from the url to determine which page is the user in right now.</p>
  
  <p>Here's a simple illustration :</p>
  
  <ol>
  <li><p>A user with "Staff" privilege logged in, and then redirected to his home page. (<a href="http://localhost/apps/staff.php" rel="nofollow noreferrer">http://localhost/apps/staff.php</a>)</p></li>
  <li><p>He open the notification page, and the url changes to : "<a href="http://localhost/apps/staff.php?cmd=notification" rel="nofollow noreferrer">http://localhost/apps/staff.php?cmd=notification</a>"</p></li>
  </ol>
  
  <p>I don't know the name of the technique, but here's how I do it : I get the cmd value using "$_GET['cmd']" and then pass it onto a function that checks what page to display. </p>
  
  <p>The problem is, I want to delete the content of notification table and move it to the history table when the user leave the page so only the newest notification will shows. So I think I need to know when the user leave (move) to another page, or when the cmd value change. My question is, how ? </p>
  
  <p>Ps. I'm still a student on a university so this is my homework. Please just point me on a direction and/or clue rather than write the code for me (and a clue to the name of that "get" technique is welcomed :p). I know I still got a lot to learn, but english is not my native and I've tried google and stackoverflow with no result (I believe it's because of my bad english and not knowing the name of the techniques I used).</p>