title: Make a variable static after multiple submissions of requests in CakePHP?
body: <p>I tried to declare a static and public variable in AppController as follows</p>
  
  <pre><code>class AppController extends Controller {
  
  
  public static $var = 0;
  
  }
  </code></pre>
  
  <p>And then access the static variable in controller of its subclass.</p>
  
  <p>My CTP file has multiple submit buttons which change the value of the static variable.</p>
  
  <p>eg.  </p>
  
  <pre><code>button A -&gt; $var ++  
  button B -&gt; $var --
  </code></pre>
  
  <p>I also tried session and started it in beforefilter function of app controller. 
  Still on multiple submission, the session variable is reset again.</p>
  
  <pre><code>class AppController extends Controller {
  
  
  public function beforeFilter() {
  parent::beforeFilter();
  $this-&gt;Session-&gt;write('var', 0);
  
  }
  }
  </code></pre>
  
  <p>In both cases(either static variable or session), the static variable can only be +1, 0 or -1. It seems the AppController is loaded on refresh of page.
  What I really want is the static variable can be + or - more than 1 after the buttons are pressed multiple times and the static variable is only reset after close of the browser. </p>