}
    }
    $dir = "VIEW/html/Encoder/Add_Specialization/Delete_Specialization.php?error={$error_type}&Specialization_ID={$Specialization_ID}";
    $url = BASE_URL . $dir;
    header("Location:{$url}");
    exit;
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if (TRUE == check_login_status()) {
        $user_type = get_user_type();
        if ($user_type == User_Type::ENCODER) {
            $encoder = $_SESSION['Logged_In_User'];
            $encoder_con = new Encoder_Controller($encoder);
            if (isset($_POST['Specialization_ID'])) {
                $Specialization_ID = $_POST['Specialization_ID'];
            } else {
                $errors[] = "Specialization id should be filled";
            }
            if (empty($errors)) {
                $deleted = $encoder_con->Delete_Specialization($Specialization_ID);
                if ($deleted) {
                    encoder_redirect_success();
                } else {
                    encoder_place_redirect(Error_Type::DATA_BASE, $Specialization_ID);
                }
            } else {
                encoder_place_redirect(Error_Type::FORM, $Specialization_ID);
            }
        }
    }
}
                        $errors[] = "Place should be filled";
                    }
                }
            }
            if (empty($errors)) {
                if (!$with_building) {
                    $deleted = $encoder_con->Delete_Company_With_Out_Building($Company_ID, $About_Company_ID, $Payment_Status_ID, $Company_Service_ID, $Company_Ownership_ID, $Company_Category_ID, $Contact_ID, $Direction_ID, $Place_ID);
                } else {
                    if ($with_building) {
                        $deleted = $encoder_con->Delete_Company_With_Building($Company_ID, $About_Company_ID, $Payment_Status_ID, $Company_Service_ID, $Company_Ownership_ID, $Company_Category_ID, $Contact_ID, $Address_Building_Floor_ID);
                    }
                }
                //check if the company has specialization
                //if the company has specialization delete the specializations
                if ($encoder_con->Company_Has_Specialization($Company_ID)) {
                    //get the specialization id and delete the specialization with the acquired ID
                    $spec_ID = $encoder_con->Get_Company_Specialization_ID($Company_ID);
                    $encoder_con->Delete_Specialization($spec_ID);
                }
                //if the company is deleted redirect the user with success
                if ($deleted) {
                    encoder_redirect_success();
                } else {
                    encoder_place_redirect(Error_Type::DATA_BASE);
                }
            } else {
                encoder_place_redirect(Error_Type::FORM);
            }
        }
    }
}