title: run a php function from js
body: <p>end goal: HTML element is click i want to run PHP functions</p>
  <p>so i want to do something like this</p>
  <pre><code>  function byeBye(page) {
      if (page == 'teacher.php') {
        &lt;?php $_SESSION['AccType'] = 1; ?&gt;
      } else if (page == 'admin.php') {
        &lt;?php $_SESSION['AccType'] = 2; ?&gt;
      }
      console.log('Redirecting to ' + page);
      window.location.href = './' + page;
    }
  &lt;/script&gt;
  </code></pre>
  <p>and it called with something like this
  <code>&lt;li id='admin' class=&quot;list-group-item&quot; onclick=&quot;byeBye('admin.php')&quot;&gt;</code>
  but you can see what is wrong with that. what is the right way to do this?</p>