title: PHP foreach shopping cart values being overwritten
body: <p>I have one array_push to push values through these are fine.</p>
  
  <p>The question is how can i make the array more reliable so that i can have more values that will not be overwritten when they are outputted to the screen.</p>
  
  <p>I currently have -</p>
  
  <pre><code>array_push($cart, array("id" =&gt; $_GET["itemId"]));
  </code></pre>
  
  <p>This gets my item id's then i use select on the other page. Is it possible to add more values?</p>
  
  <p>On my other page i have -</p>
  
  <pre><code>        $cart = $_SESSION["cart"];
  
          echo "Your Cart Contains: &lt;br /&gt;";
  
          $counter = 0;
  
          foreach($cart as $key){
              foreach($cart [$counter] as $item =&gt; $value){
                  echo '&lt;div id="checkoutList"&gt;&lt;cartNum&gt;' . $counter . '&lt;/cartNum&gt;' . '&lt;productNum&gt;' . $value . '&lt;/productNum&gt;' . '&lt;productImg&gt;&lt;img width="100px" height="70px" src="../Images/' . $image . '"/&gt;&lt;/productImg&gt;' . '&lt;productDesc&gt;' . $desc . '&lt;/productDesc&gt;' . '&lt;productRemove&gt;&lt;a href="removeItem.php?counter=' . $counter . '"&gt;&lt;input width="200px" height="400px" type="button" value="remove" class="buttonCSS"/&gt;&lt;/a&gt;&lt;/productRemove&gt;&lt;/div&gt;&lt;br /&gt;';
              }
              $counter++;
  
          }
  </code></pre>
  
  <p>The problem is that <code>$image</code>, <code>$desc</code> are being overwritten to equal the same over each product being displayed in the basket. I believe this is because they aren't being set as separate values in array so that they can differ from each other. </p>
  
  <p>Is there a way that i can put them into the same array or in fact a different one which can be run with the <code>foreach</code> loop to differ each product?</p>