<?php 

include("config.php");



$id=$_POST['id'];

$uploadFolder = "uploads/";	
if (!file_exists($uploadFolder)) {
    mkdir($uploadFolder, 0777, true);
}
	
	
$filename = $_FILES['file1']['name'];
if($filename!=""){

$ext = substr($filename, strrpos($filename, '.') + 1); 
$a=$id."_1.".$ext;

copy ($_FILES['file1']['tmp_name'], "uploads/".$a);
	
	mysql_query("update    customer set file1='$a'  where id='$_POST[id]' limit 1");
	
} 
	
$filename = $_FILES['file2']['name'];
if($filename!=""){

$ext = substr($filename, strrpos($filename, '.') + 1); 
$b=$id."_2.".$ext;

copy ($_FILES['file2']['tmp_name'], "uploads/".$b);

	mysql_query("update    customer set file2='$b'  where id='$_POST[id]' limit 1");
	
} 

 
		
		
	mysql_query("update    customer set 
	
	customer_name='$_POST[customer_name]', contact_person='$_POST[contact_person]', personal_phn='$_POST[personal_phn]', nid='$_POST[nid]', personal_email='$_POST[personal_email]', address='$_POST[address]' where id='$_POST[id]' limit 1");

header("location:add_client.php");
 
?>