<?php
	session_start();
    include_once"includes/conn.php";
    include_once"functions/Success.php";
    include_once"functions/Error.php";

if (isset($_POST['Delete'])) {
		$list = mysqli_real_escape_string($conn,strip_tags($_POST['list']));
    	$TC= mysqli_real_escape_string($conn,strip_tags($_POST['TC']));
   
		if(empty($TC) ||  empty($list)){
			header('Location: Add-Shipment.php?re=1');
		}else{
			$sql = "SELECT TrackNum from details where TrackNum = '$TC'";
			$result = mysqli_query($conn, $sql);
			if (mysqli_num_rows($result)>0) {
				while ($rows = mysqli_fetch_assoc($result)) {
                    $Tcode = $rows['TrackNum']; 
                   
				if ($TC !== $Tcode) {
				}else{
					$sql = "INSERT into listitem (track_num,list) values ('$TC','$list');";
			$result= mysqli_query($conn, $sql);
			header('Location: Add-Shipment.php?ree=1');
			}
		}
	}
}
}
?>