<?php
include('db_connection.php');
$Mainclass=new DB_Controller();
$Order_Id=$_REQUEST['Order'];
$Check_Order=$Mainclass->num_check('order_address_master_gold',"SLN","Order_No='".$Order_Id."'");
$Customer_Name=$Mainclass->real_escapes($_REQUEST['Cus_name'])." ".$Mainclass->real_escapes($_REQUEST['cust_lname']);
if($Check_Order==0)
{
if($_REQUEST['Aniversary']!='')
{
$Aniversary=date('Y-m-d',strtotime($_REQUEST['Aniversary']));	
}
else
{
$Aniversary='';	
}
if($_REQUEST['Bday']!='')
{
$DOB=date('Y-m-d',strtotime($_REQUEST['Bday']));	
}
else
{
$DOB='';	
}
	 $Fields='Order_No,Customer_Name,Contact,Email,Address_Line1,Address_Line2,State,Pin,Country,City,Purchase_Reason,Promotion,Ethinicity,Hear_About,Member,Gender,Marital_Status,Salutation,Building_No,Street_Name,Customer_Gst,Member_Id,Order_Date,Dealer_Code,Anniversary_Date,DOB_Type';
	 /*if($_REQUEST['Aniversary']!='')
	 {
	 $Fields.=",Anniversary_Date";
	 }
	if($_REQUEST['Bday']!='')
	 {
	 $Fields.=",DOB";
	 }*/
	if($_REQUEST['Bday_Type']=='DOB')
	{
		//$dob=$DOB;
		$Fields.=',DOB';
	}
	else{
		$Fields.=',Age';
	}
	$Values="'".$_REQUEST['Order']."','".$Customer_Name."','".$_REQUEST['mobile']."','".$_REQUEST['emailid']."','".$Mainclass->real_escapes($_REQUEST['address1'])."','".$Mainclass->real_escapes($_REQUEST['address2'])."','".$_REQUEST['State']."','".$_REQUEST['pincode']."','".$_REQUEST['Country']."','".$_REQUEST['City']."','".$_REQUEST['Reason']."','".$_REQUEST['Promotion']."','".$_REQUEST['Ethni']."','".$_REQUEST['Hearabout']."','".$_REQUEST['Member']."','".$_REQUEST['Gender']."','".$_REQUEST['Marital']."','".$_REQUEST['Salute']."','".$_REQUEST['Building_No']."','".$_REQUEST['Street']."','".$_REQUEST['Customer_Gst']."','".$_REQUEST['Membership_Id']."','".date('Y-m-d')."','".$_COOKIE['O_Code']."','".$Aniversary."','".$_REQUEST['Bday_Type']."'";
	
	if($_REQUEST['Bday_Type']=='DOB')
	{
		//$dob=$DOB;
		$Values.=",'".$DOB."'";
	}
	else{
		$Values.=",'".$_REQUEST['Bday_Age']."'";
	}
	
	$Insert_Master=$Mainclass->Insert_Data('order_address_master_gold',$Fields,$Values);
}
?>