删除特定会话

I was trying to Programming simple add cart , update cart and delete cart but i have problem in delete a particular session for that when i try to delete one items it`s delete all items but i want only one item Like amazon So i will appreciate any help ^_^"

code

<?php   
session_start(); 
$test=$_POST['test'];  

 
if(isset($_POST['submit'])){ 

 $count=count($_SESSION['shopping_cart']); 
   $_SESSION['shopping_cart'][$count]['id1']= $count;
  $id222= $_SESSION['shopping_cart'][$count]['id']=$test ; 
 $_SESSION['shopping_cart'][$count]['name']= $_POST['name'] ;
 $_SESSION['shopping_cart'][$count]['price']= $_POST['price'] ;

echo "  done";
 
 
  } 

  
  // for update
if(isset($_POST['update1'])) {
      $id22=$_POST['update'];
        foreach($id22 as $id12 => $test1) {
         $_SESSION['shopping_cart'][$id12]['id']=$test1 ; 
             echo $id12 ; 
            echo " $test1 <br> "; 

        }
 }  
 // for delete 
if(isset($_POST['delete'])) { 
          $id221=$_POST['update'];
        foreach($_SESSION['shopping_cart'] as $id12 => $test1) {
        if($id22 == $id_product ){
            unset($_SESSION['shopping_cart'][$id12] )  ; 
        } 
        }
 } 

 
$total=0;
 foreach($_SESSION['shopping_cart'] as $product){ 
  $id_product= $product['id1']; 
  echo  " <form action='' method='POST' ><input type='text' name='update[$id_product]'  value= '$product[id]' >  
    
<input name='delete' type='submit' value='delete' >
      
       "; 
     echo "  <input name='delete' type='submit' value='delete' >";
    echo  " name = $product[name] <br> ";
      $total= $total + ($product[id]) * ($product[price]) ;
   
  } 
echo $total ;
 echo " <input name='update1' type='submit' value='update' >  </form>";
  echo $count;

 ?>
  
  <form action="" method="post" >
     <select name="test"> 
     <option value="1">1</option> 
     <option value="2">2</option> 
     <option value="3">3</option> 
     <option value="11">11</option> 
     <option value="12">21</option> 
     <option value="13">31</option> 

     </select> 
    <input name="name" type="text" >
         <input name="price" placeholder="price" type="text" >

  <input type="submit"  name="submit" value="add">  
   
  </form>

</div>