<?php 
include "../config.php";
$ticket = $_POST['ticket'];
//echo $customer;
if ($ticket != '')
{
$sql = "select *,(select customerdetails.name from customerdetails where customerdetails.code = ticket.customer )as cusname,(select productdetail.productname from productdetail where productdetail.productcode = ticket.product )as proname from ticket where ticket = '$ticket' && status !='deleted'";
//echo $sql;
$conn=mysqli_query($connect,$sql);
while($row=mysqli_fetch_array($conn))
{
       $customer = $row['customer'];
       $output='.<option value='.$row['customer'].'>'.$row['cusname'].'</option>';
       //$output=$row['cusname'];
       $cus=mysqli_query($connect,"select * from customerdetails where status !='deleted' && code !='$customer'");
       while($cusshow = mysqli_fetch_array($cus))
       {
      
              $output.='.<option value='.$cusshow['code'].'>'.$cusshow['name'].'</option>
       ';
       }
         
}
echo $output;
}
else
{
 echo "";
}

?>
