<?php 

		$pid	= $_POST['pid'];
		$xuid	= $_POST['xuid'];
		$lang 	= $_POST['lang'];			
		$mid	= $_POST['mid'];				
		$newrecid	= $_POST['newrecid'];						
		$code_center	= $_POST['code_center'];
		$code_categ		= $_POST['code_categ'];



include('r_dbc.php');

$sql = "INSERT INTO ccmanager (pid,mid,code_center,code_categ,rab_qty,xuid,newrecid)
				SELECT '$pid','$mid','$code_center','$code_categ',null,'$xuid','$newrecid'";
		// echo $sql;
		$result = mysqli_query($conn, $sql);
mysqli_close($conn);


include('r_dbc.php');
 		$sql = "select cid
		from ccmanager
		where newrecid = '".$newrecid."'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
      while($row = mysqli_fetch_assoc($result)) {
		$cid = $row["cid"];
		}
	}
mysqli_close($conn);		


$ref = "nf_manager_edit.php?pid=".$pid."&mid=".$mid."&xuid=".$xuid."&lang=".$lang."&editId=".$cid;

echo '<script>window.location = "'.$ref.'";</script>';  
exit;

		
?>

