title: How to store multiple form $_POST in session
body: <p>I try to store in $_SESSION each $_POST send from input,
  So i have search bar, somebody can send query multiple times and ultimately gets the result from all query from search.
  My problem is, that $_SESSION store each time only last form action. In the meantime, I check if his query is in the database and display the data from the database, if it exists</p>
  <pre><code>function search()
  {
      session_start();
      if (isset($_SESSION['fraza'])) {
          $_SESSION['fraza'] = array();
      }
  
      global $wpdb, $user_ID;
      $query_form_value;
      $data = array();
      $table_name = $wpdb-&gt;prefix . 'pozycje';
      $domain = get_site_url();
  
      if (isset($_POST['wyszukaj']) &amp;&amp; !empty($_POST['wyszukiwarka'])) {
          $search_array = array();
          $array_exists = array();
          $sql = ('SELECT * FROM wp_pozycje ');
  
          $fraza = $_POST['wyszukiwarka'];
          //array_push( $search_array, $fraza);
  
          array_push($_SESSION['fraza'], $fraza);
  
          $exists_results = $wpdb-&gt;get_results($sql);
  
          print_r($_SESSION['fraza']);
          echo '&lt;/br&gt;';
  
          foreach ($exists_results as $exists) {
              $array_exists[] = $exists-&gt;numer;
          }
  
          $results_array = array_intersect($search_array, $array_exists);
          echo 'tablica z bazy&lt;/br&gt;';
          print_r($array_exists);
  
          echo 'tablica z porownania&lt;/br&gt;';
          print_r($results_array);
  
      }
  }
  
  search();
  </code></pre>