 <?php 
if(isset($_POST['refno'])){
extract($_POST);
require 'connection.php';

	$supname="SELECT max(trid) trid from broilertransfer where refno='$refno'";
	$suprun=mysqli_query($connect,$supname) or die(mysqli_error($connect));
	$suprow=mysqli_fetch_array($suprun);
	$trid= $suprow['trid'];


$supname="SELECT accid from broilertransfer where trid='$trid'";
	$suprun=mysqli_query($connect,$supname) or die(mysqli_error($connect));
	$suprow=mysqli_fetch_array($suprun);
	$custid= $suprow['accid'];
		echo ($custid);

}

?>