title: Creating shopping cart website,subprice problems
body: <p><a href="https://i.stack.imgur.com/Lx1Rn.png" rel="nofollow noreferrer">shopping cart image</a></p>
  
  <p>I want to create subprice function that shows at the colomn, but i dont know how to print the subprice from the quantity below the first id, please help me :D
  this code is to shows the subprice </p>
  
  <pre><code>&lt;div class="col-sm-2 text-center" id="test"&gt;
    &lt;script&gt;
      $("input[name=quantity0]").on("keydown",function(){
      id= "&lt;?php echo $id ;?&gt;";
      var price;
      quantity=$("input[name=quantity0]").val();
      for(i=0;i&lt;carts.length;i++){
      if(id==1){
        price=30;
        total=price*quantity;
        $("#test").text("$"+total);
      }
      if(id==2){
        price=30;
        total=price*quantity;
        $("#test").text("$"+total);
      }
      if(id==3){
        price=30;
        total=price*quantity;
        $("#test").text("$"+total);
      }
      if(id==4){
        price=30;
        total=price*quantity;
        $("#test").text("$"+total);
      }
      if(id==5){
        price=30;
        total=price*quantity;
        $("#test").text("$"+total);
      }
      if(id==6){
        price=30;
        total=price*quantity;
        $("#test").text("$"+total);
      }
      if(id==7){
        price=30;
        total=price*quantity;
        $("#test").text("$"+total);
      }
      if(id==8){
        price=30;
        total=price*quantity;
        $("#test").text("$"+total);
      }
      if(id==9){
        price=30;
        total=price*quantity;
        $("#test").text("$"+total);
      }
      if(id==10){
        price=30;
        total=price*quantity;
        $("#test").text("$"+total);
      }
    }
    });
    &lt;/script&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>
  
  i uploaded it on my website <a href="http://scellion.hol.es/" rel="nofollow noreferrer">http://scellion.hol.es/</a> in case you guys need to try to understand the problems :D</p>