php - Displaying Only the Items in the Cart? -




so need display items added on vend page , in cart array on onto cart page in list

 array  (      [cart] => array     (         [brb] => 1     )  ) 

here code cart page i'm working on:

 if (isset($_session['cart'])) {     foreach ($vend $vendid => $items) {   //if (array_search($vendid, $_session['cart'])) {      echo "<article class ='cart' id='cart-$vendid'>";  echo "<h1 class = 'item-h1' id = 'h1'>{$items['title']}</h1>";  echo "<div class ='item-no'>";  echo "<p class = 'pro-id'><b>product id:  </b>{$vendid}</p></div>";   echo "<div class ='img-div'>";  echo "<img src =../images/{$items['img']} alt='' height='196' width='200'></div>";   echo "<div class='pricing'>";  echo "<p><b>price: $</b>{$items['price']}</p></div>";  echo "</article>";   //}    }  }  

i commented out code attempted didn't work. need if statement says, if vendid in cart array display in list.

some appreciated here i'm stuck.

did try in_array() ? checks if value exists in array.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -