/** * get the user name from post */ if (empty($_POST['Region_Name'])) { $errors[] = "Region should be filled"; } else { $region_name = $_POST['Region_Name']; } if (empty($_POST['Region_Name_Amharic'])) { $errors[] = "Amharic name should be filled"; } else { $region_name_amharic = $_POST['Region_Name_Amharic']; } if (empty($errors)) { $region = new Region($region_name, $region_name_amharic); if ($encoder_con->Region_Exists($region)) { encoder_place_redirect(Error_Type::SAME_USER_NAME); } $added = $encoder_con->Add_Region($region); /** * inform the encoder about the result */ if ($added) { encoder_redirect_success($region); } else { encoder_place_redirect(Error_Type::DATA_BASE); } } else { encoder_place_redirect(Error_Type::FORM); } }