if ($action == 'Save') {
    $officename = clean_spl($_POST['officename']);
    $designationOic = $_POST['designationOic'];
    $Street = clean_spl($_POST['Street']);
    $Town = clean_spl($_POST['Town']);
    $PostOffice = clean_spl($_POST['PostOffice']);
    $Subdivision = $_POST['Subdivision'];
    $PoliceStation = $_POST['PoliceStation'];
    $Municipality = $_POST['Municipality'];
    $Pincode = only_num($_POST['Pincode']);
    $Statusofoffice = $_POST['Statusofoffice'];
    $Natureofoffice = $_POST['Natureofoffice'];
    $email = $_POST['email'];
    $Ph_no = clean_alpha($_POST['Ph_no']);
    $Mb_no = clean_alpha($_POST['Mb_no']);
    $FAX_no = clean_alpha($_POST['FAX_No']);
    $MaleStaff = only_num($_POST['MaleStaff']);
    $FemaleStaff = only_num($_POST['FemaleStaff']);
    $ExistingStaff = only_num($_POST['ExistingStaff']);
    $OfficeID = $_POST['OfficeID'];
    $dist_code = $dist_cd;
    $usercd = $user_cd;
    if ($Subdivision == $subdiv_cd) {
        include_once 'function/add_fun.php';
        $ret;
        if (isset($_REQUEST['officeid'])) {
            $dt = new DateTime();
            $posted_date = $dt->format('Y-m-d H:i:s');
            $ret = update_officedetails($OfficeID, $designationOic, $officename, $Street, $Town, $PostOffice, $Pincode, $Municipality, $PoliceStation, $Statusofoffice, $email, $Ph_no, $Mb_no, $FAX_no, $ExistingStaff, $MaleStaff, $FemaleStaff, $Subdivision, $dist_code, $Natureofoffice, $usercd, $posted_date);
            if ($ret == 1) {
                redirect("office-details.php?msg=success");
 $scale = clean_alpha($_POST['scale']);
 $basicpay = only_num($_POST['basicpay']);
 $gradepay = only_num($_POST['gradepay']);
 $preaddress1 = clean_spl($_POST['preaddress1']);
 $preaddress2 = clean_spl($_POST['preaddress2']);
 $peraddress1 = clean_spl($_POST['peraddress1']);
 $peraddress2 = clean_spl($_POST['peraddress2']);
 $workingstatus = $_POST['workingstatus'];
 $email = $_POST['email'];
 $r_no = clean_alpha($_POST['r_no']);
 $m_no = clean_alpha($_POST['m_no']);
 $qualification = $_POST['qualification'];
 $language = $_POST['language'];
 $bank = $_POST['bank'];
 $branch = $_POST['branch'];
 $acc_no = clean_alpha($_POST['acc_no']);
 $voterof = $_POST['voterof'];
 $partno = $_POST['partno'];
 $sl_no = $_POST['sl_no'];
 $epic_no = $_POST['epic_no'];
 $ac_pre = $_POST['ac_pre'];
 $ac_per = $_POST['ac_per'];
 $ac_posting = $_POST['ac_posting'];
 $posting_status = $_POST['posting_status'];
 $remarks = clean_spl($_POST['remarks']);
 $group = $_POST['group'];
 $upload_file = "";
 if (empty($_FILES['file']['name'])) {
     $upload_file = $_POST['hid_file'];
 } else {
     if ($_FILES['file']['size'] >= 10240 && $_FILES['file']['size'] <= 30720) {