<?php 
		for($i=0;$i<$row;$i++){
			$pm_autoid = $_POST["pm_autoid".$i];
			$qty = $_POST["qty".$i];
			$dnotes = $conn->real_escape_string($_POST["dnotes".$i]);
			$price = $_POST['price'.$i];
			$ums	=	strtoupper($_POST['um'.$i]);
			
			if($qty!=0){
				$sqlprod = "SELECT * FROM mst_product
							WHERE pm_autoid = '$pm_autoid' LIMIT 0,1";
				$prod_conn = $conn->query($sqlprod) or die($sqlprod);
				$prod = $prod_conn->fetch_assoc();
				$prod_name = $conn->real_escape_string($prod['pm_name']);

								$sqlin = "INSERT INTO invtransd 
										(invt_autoid,pm_autoid,pm_name,invtd_qty,invtd_um,invtd_notes,invtd_bprice) 
										VALUES 
										('$autoid','$pm_autoid','$prod_name','$qty','$ums','$dnotes','$price')";
										if($prod_name){
											$conn->query($sqlin) or die($sqlin);
										}

				}
			
		}
?>