title: PHP Set $_SESSION variable value according to (Button/Link) click
body: <p>I have the following Code :<br></p>
  
  <pre><code>&lt;ul&gt;
   &lt;li&gt;
    &lt;a href="index.php?page=quiz" class="cat" &gt;
      &lt;h3&gt;Category 1&lt;/h3&gt;
      &lt;p&gt;(explain here)&lt;/p&gt;
    &lt;/a&gt;
   &lt;/li&gt;
   &lt;li&gt;
    &lt;a href="index.php?page=quiz" class="cat" &gt;
      &lt;h3&gt;Category 2&lt;/h3&gt;
      &lt;p&gt;(explain here)&lt;/p&gt;
    &lt;/a&gt;
   &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>What I need is to send the category number to the page <code>index.php?page=quiz</code>
  via <code>$_POST</code> or anything else
  without sending it via <code>$_REQUEST</code> like this <code>index.php?page=quiz&amp;cat=1</code><br>
  <strong>OR</strong> assigning the category number value to a <code>$_SESSION</code> variable according to current clicked link
  to get the value at destination page <code>index.php?page=quiz</code>.</p>
  
  <p><br>
  <strong>I have already tried this solution:</strong>
  
  <li>Via <code>javascript</code> by sending the variable value to the page</p>
  
  <pre><code>var num=1; /*or put the current clicked category number */
  $.ajax({
          url: 'index.php?page=quiz',
          type: 'post',
          dataType: 'json',
          data: {
              category_no: num,
          }
      })
  </code></pre>
  
  <p>There seems to be a problem with the sending process and the value of <code>page=quiz</code>
  is not send to the destination and we are still on the current page where <code>page=home</code>.</p>
  
  <p><strong>Do you have any helpful ideas?</strong><br></p>
  
  <p><strong>NOTE: My problem is not getting the category id from current clicked (button/link) to <code>javascript</code>, but sending it to destination page with any of the ways mentioned above.</strong>
  <br></p>