i’m trying to get product id and QTY that user will insert the product id coming fine but ajax code every time showing first row qty same value. below is my code.

`while ($data=$query->fetch(PDO::FETCH_OBJ)) {

$pdid=$data->id;

$pid=$data->pid;

$title=$data->title;

$image=$data->img;

$price=$data->price;

$status=$data->status;

$desc1=$data->desc1;

$desc=strip_tags($desc1);

$in = “instock”;
$out= “outofstock”;

?>

<td style="border:none;">


  <div class="animated zoomIn">


   <div class="popular-items pt-50 " style="margin-right: 8px;">


        <div class="container-fluid">


          <div class="row">


            <div class="col-12">


                    <div class="single-popular-items mb-50 text-center wow fadeInUp" data-wow-duration="1s" data-wow-delay=".1s">


                    <div class="panel panel-default">
                      <div class="panel-heading">
                        <img src="../admin/upload_images/<?php echo $image; ?>" alt="Loading" class="img img-fluid" style="width:270px;height: 170px;">
                      </div>
                      <div class="panel-body">
                       
                         <span style="font-weight: bold;font-size: 18px"><?php echo ucfirst($title); ?></span><br><br>
                         <center> <span style="font-weight: bold;font-size: 16px;">Price:  $<?php echo ucfirst($price); ?></span></center><br><br>
                         <label>Choose Qty</label>
                          <input type="text" id="qty" name="qty" class="newqty form-control" value="1">
                         
                      </div>
                            
                      <div class="panel-footer">
                       <?php
                       if($status==$in)
                       {
                        ?>
                         <div class="form-group">
                          <input type="button" name="" id="<?php echo $pdid?>" class="select form-control btn btn-default" value="Select for order">
                        </div>
                        <div class="form-group">
                           <input type="button" name="" id="select" class="form-control btn btn-default" value="Read More">
                        </div>
                        
                      </div>
                        <?php
                       }else
                       {
                        echo'<div class="text text-info"><center><strong>Product currently not available.</strong></center></div><br>';
                       }
                       ?>
                    </div>


                    </div>


                </div>


                 </div>


                    </div>


                </div>


  </div>





</td>

`

$(document).ready(function(){

  $(".select").click(function(){


    var id= $(this).attr("id");

    var qty1= $(".newqty").attr("value");


    $.ajax({


      url:"save-order.php",


      method:"post",


      data:{id:id,qty1:qty1},

      success:function(data){


         $("#final").html(data);


         





      }


    });


  });

});

can any one help how i can get the QTY number of each product like product id coming

New contributor

Muhammad Asim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.