<?php   include_once('../config/db.php');  include_once('../config/check2.php'); 

       $data='';
    if(isset($_POST["product"]))
      {    
          
            $product =  $_POST['product'];
            $i =  $_POST['counter'];

            $res = $conn->query("  SELECT a.*  FROM products a  WHERE  a.id='$product' ; ");

 
                    foreach ($res as $row) 
                        {      
                              // if ( $row["dvalue"] ==0 )
                              //   {
                                    $total=  ( $row["price"] ) ;
                                    $subtotal=  ( $row["price"]  ) ;
                                    $itemrate = 0.00;
                              //   }
                              //  else
                              //   {
                              //       $rate = $row["dvalue"] / 100 ;
                              //       $itemrate =  ( $row["itemprice"] - $row["itemdiscount"] )  * $rate  ;
                              //       $subtotal =    $row["itemprice"] - $row["itemdiscount"]  ;
                              //       $total =   $itemrate + ( $row["itemprice"] - $row["itemdiscount"] ) ;
                              //   }
                     
                            $data .= '<tr id="row'.$i.'"  >       
                              <td><input type="" class="form-control col-xs "   value="'.$row["name"].'">
                                  <input type="hidden" class="form-control col-xs item "   id="item'.$i.'" name="item[]"  value="'.$row["id"].'">
                              </td>
                             
                              <td class="input-group"> 
                                   <input type="text" class="form-control col-xs unit " id="unit'.$i.'"  name="unit[]" value=1 autocomplete="off" >
                                    
                              </td>                           
                              <td><input type="text" class="form-control col-xs price "  id="price'.$i.'" name="price[]" readonly="true" value="'.$row["price"].'">
                                      
                              </td>                           
                              <td> 
                                   
                              <input type="" name="payable[]" id="payable'.$i.'"  class="form-control payable " readonly="true"   value="'.$total.'" >    
                              </td>                       
                              <td><button type="button" name="remove" id="'.$i.'" class="btn btn-danger btn-xs btn-block remove"> <i class="fa fa-trash"></i> </button></td></tr>'; 
                         
                               
                        }
                              
                      //  $data .= "";  

       }


      

       echo ($data);
 ?>