title: Subtraction of variable PHP
body: <p>i cant figure out how can i subtract 2 from a variable ($energia) each time i click on a html link. Problem is that it only subtracts once, so the output will always be 18. </p>
  
  <pre><code>&lt;?php 
  $energia = 20;
  
  
  if(isset($_GET["action"]) &amp;&amp; $energia != 0)
  {
  $energia -=2;
  
  }
  }
  ?&gt;
  
  
  &lt;a href="?action" &gt;subtract&lt;/a&gt; &lt;?php echo $energia2; ?&gt;
  </code></pre>