title: cart session array
body: <p>I am building a simple shop cart and I am getting the following array from product page(when the user submits add to cart button)...</p>
  
  <pre><code>Array ( [product_id] =&gt; 1 [weight] =&gt; 2 [size] =&gt; 4 [type] =&gt; cafe [cost] =&gt; 6323.86 )
  </code></pre>
  
  <p>and after that I am saving it to <code>session</code> to showing later on cart...</p>
  
  <pre><code>$_SESSION['cart']= $data; //$_POST values into $data
  </code></pre>
  
  <p>it works great for if user adds only 1 product into cart, but if he adds another product the $_SESSION['cart'] array replaces with new value, but i want it save all selected product's details, how can i achieve that?</p>