title: Substitute to get value of button without form action post method
body: <p><strong>Problem Statement:</strong> 
  Get value of button in PHP, without form-action-post method.</p>
  
  <p><strong>Overview:</strong> Developing a web application to manage time-sheet of employees, </p>
  
  <ol>
  <li>User selects current project, and fills his/her time according to task assigned. </li>
  <li>After s/he fill, submits time-sheet to his/her manager.
  <a href="https://i.stack.imgur.com/hr1wl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hr1wl.jpg" alt="enter image description here"></a> </li>
  </ol>
  
  <p><strong>Code(to display pre-defined projects from DB, enter_time.php)</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  ...
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form action="enter_time.php"  method="post"&gt;
  &lt;?php if (is_array($separateProjects) || is_object($separateProjects)):?&gt;
  &lt;?php foreach ($separateProjects as $val):?&gt;
  
  &lt;?php if(strcmp($_SESSION['project_selected'],$val)==0):?&gt; 
  &lt;button style="float:left" class="btn-default active-project" name="PROJECT" type="hidden" value="&lt;?php echo $val ?&gt;"&gt;  
  &lt;?php echo $val ?&gt;&lt;/button&gt; 
  &lt;?php else: ?&gt; 
  &lt;button style="float:left" class="btn-default inactive-project"  name="PROJECT" type="hidden" value="&lt;?php echo $val ?&gt;"&gt;  
  &lt;?php echo $val ?&gt;&lt;/button&gt;
  &lt;?php endif; ?&gt;
  &lt;?php endforeach; ?&gt;
  &lt;?php endif; ?&gt;
  &lt;/form&gt;
    ...
  &lt;/body&gt;
  ....
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Code( when user selects particular project, enter_time.php):</strong></p>
  
  <pre><code>function projectDisplay()
    {
        $_SESSION['project_selected'] =$_POST["PROJECT"];
    };
  
    if(isset($_POST['PROJECT']))
    {
       projectDisplay();
    } 
  </code></pre>
  
  <p><strong>Question:</strong> How do i get value of button in PHP, without form-action-post method? and save that value on _SESSION variable?.</p>
  
  <p><strong>Reason:</strong> When user selects particular project from list (clicks on project name button), entire page gets refreshed, and all other values of the screen example date,task list, etc get reset, and i am storing this project value in _SESSION variable for the further processes.</p>
  
  <p>I am happy to any missing detail(s) if any. 
  Help would be appreciated.  </p>