<?php include 'connection.php';
session_start();
if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }
?>

<?php 
$querylogin = "select * from staff_login where username = '". $_SESSION["LOGIN_NAME"]."' AND password = '".$_SESSION["EMPLOYEE_PASSWORD"]."'";
$resultlogin = mysql_query($querylogin,$conn);
while($row=mysql_fetch_array($resultlogin))
{
$Designation = $row['designation'];
$staff_name = $row['staff_name'];

}
?>
<?php 
date_default_timezone_set('Asia/Calcutta');
$today = date("Y-m-d");
$time = date("h:i A"); 
$currentyear = date("Y");

$customer_id = $_REQUEST['customer_id'];

$id = $_REQUEST['id'];


//echo $_POST['cntcount2'];
$saddrl1 = $_POST['saddrl1'];
$scountry = $_POST['scountry'];
$sstate = $_POST['sstate'];
$sdistrict = $_POST['sdistrict'];
$scity = $_POST['scity'];


$spin = $_POST['spin'];
$semail = $_POST['semail'];
$sphone = $_POST['sphone'];
$sfax = $_POST['sfax'];
$sgst_no = $_POST['sgst_no'];
$sstate_code = $_POST['sstate_code'];

$query2f = "insert into factory_address (address,country,state,district,city,pincode,email,phone,fax,suburb,gst_no,sstate_code,customer_id,id) values ('$saddrl1','$scountry','$sstate','$sdistrict','$scity','$spin','$semail','$sphone','$sfax','$ssuburb','$sgst_no','$sstate_code','$customer_id','$id')";
//echo $query2f;
$rf=mysql_query($query2f,$conn);


$query2aac="update customer_master set shipping_address ='$saddrl1',scountry='$scountry',sstate='$sstate',sdistrict='$sdistrict',spin='$spin',semail='$email',sphone='$sphone',sfax='$sfax',scity='$scity',sgst_no='$sgst_no',sstate_code='$sstate_code' where customer_id = '" . $_REQUEST['customer_id'] . "' and id = '" . $_REQUEST['id'] . "'";


$r2=mysql_query($query2aac,$conn);



//echo $query11;


//exit();

?>
<script>
javascript:window.location.href="more_factory_address.php?customer_id=<? echo $customer_id ?>&&id=<? echo $id?>&&msg='Record Added Successfully'";
</script>		
