title: PHP click counter
body: <p>I have a .php script that counts the clicks of a button and places them into a .txt file, all fine here but what I have now only works on a single count. If, let's say, I make two buttons, it will show the same number of clicks for both of them.</p>
  
  <p>I need the script to work foreach button separately...</p>
  
  <p>PHP:</p>
  
  <pre><code>if( isset($_POST['clicks']) ) { 
      incrementClickCount();
  }
  
  function getClickCount()
  {
      return (int)file_get_contents("clickit.txt");
  }
  
  function incrementClickCount()
  {
      $count = getClickCount() + 1;
      file_put_contents("clickit.txt", $count);
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form action="&lt;?php $_SERVER['PHP_SELF']; ?&gt;" method="post"&gt;
      &lt;input type="submit" value="click me!" name="clicks"&gt;
  &lt;/form&gt;
  &lt;div&gt;Click Count: &lt;?php echo getClickCount(); ?&gt;&lt;/div&gt;
  </code></pre>