<?php
 	session_start(); 

	if(!isset($_SESSION['tulsilogin']))
	{
		header('Location: index.php');
		return;
	}
	
	





$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));

	

	

	include("connect.php");



	
	$contactmid=$_POST['contactmid'];
	$contactname=str_replace ("'","\'",$_POST['contactname']);
	$contactname=str_replace ('"','\"',$contactname);
	
	$cmiddlename=str_replace ("'","\'",$_POST['cmiddlename']);
	$cmiddlename=str_replace ('"','\"',$cmiddlename);
	
	$csurname=str_replace ("'","\'",$_POST['csurname']);
	$csurname=str_replace ('"','\"',$csurname);
	
		$contactnumber=str_replace ("'","\'",$_POST['contactnumber']);
	$contactnumber=str_replace ('"','\"',$contactnumber);
	$cmobilenumber=str_replace ("'","\'",$_POST['cmobilenumber']);
	$cmobilenumber=str_replace ('"','\"',$cmobilenumber);
	$contactemail=str_replace ("'","\'",$_POST['contactemail']);
	$contactemail=str_replace ('"','\"',$contactemail);
		$caltenateemail=str_replace ("'","\'",$_POST['caltenateemail']);
	$caltenateemail=str_replace ('"','\"',$caltenateemail);
	$contactdepartmnet=str_replace ("'","\'",$_POST['contactdepartmnet']);
	$contactdepartmnet=str_replace ('"','\"',$contactdepartmnet);
	$cposition=str_replace ("'","\'",$_POST['cposition']);
	$cposition=str_replace ('"','\"',$cposition);
	$clinktype=str_replace ("'","\'",$_POST['clinktype']);
	$clinktype=str_replace ('"','\"',$clinktype);
	
	$cremarks=str_replace ("'","\'",$_POST['cremarks']);
	$cremarks=str_replace ('"','\"',$cremarks);
	
	$caddress1=str_replace ("'","\'",$_POST['caddress1']);
	$caddress1=str_replace ('"','\"',$caddress1);
	
	$caddress2=str_replace ("'","\'",$_POST['caddress2']);
	$caddress2=str_replace ('"','\"',$caddress2);
	
	$ccountry=str_replace ("'","\'",$_POST['ccountry']);
	$ccountry=str_replace ('"','\"',$ccountry);
	$cpostalcode=str_replace ("'","\'",$_POST['cpostalcode']);
	$cpostalcode=str_replace ('"','\"',$cpostalcode);
	
	$cmsgappname=str_replace ("'","\'",$_POST['cmsgappname']);
	$cmsgappname=str_replace ('"','\"',$cmsgappname);
	
	$cmsgappid=$_POST['cmsgappid'];
	
	
	$cvideoappname=str_replace ("'","\'",$_POST['cvideoappname']);
	$cvideoappname=str_replace ('"','\"',$cvideoappname);
	
	$cvideoappid=$_POST['cvideoappid'];
	
	
	$ccompanyname=str_replace ("'","\'",$_POST['ccompanyname']);
	$ccompanyname=str_replace ('"','\"',$ccompanyname);
	
	$cstate=str_replace ("'","\'",$_POST['cstate']);
	$cstate=str_replace ('"','\"',$cstate);
	
	$ccity=$_POST['ccity'];
	
	

	 $eve = "update res_contact_master set contactname='$contactname',contactnumber='$contactnumber',cmobilenumber='$cmobilenumber',contactemail='$contactemail',contactdepartmnet='$contactdepartmnet',cposition='$cposition',clinktype='$clinktype',cmiddlename='$cmiddlename',csurname='$csurname',caltenateemail='$caltenateemail' ,cremarks='$cremarks',caddress1='$caddress1',caddress2='$caddress2',ccountry='$ccountry',cpostalcode='$cpostalcode',cmsgappname='$cmsgappname',cmsgappid='$cmsgappid',cvideoappname='$cvideoappname',cvideoappid='$cvideoappid',ccompanyname='$ccompanyname',cstate='$cstate' ,ccity='$ccity'  where contactmid='$contactmid'";

	

	if ($conn->query($eve) === TRUE)

	{		

		$_SESSION['msg'] = "contact Record Updated succesfully";

		header('Location: contact.php');		

	} 

	else 

	{

			

		$_SESSION['msg'] = "Error";

		header('Location: contact.php');

	}

?>