/** * get the user name from post */ if (empty($_POST['SubCity_Name'])) { $errors[] = "Sub City should be filled"; } else { $sub_city_name = $_POST['SubCity_Name']; } if (empty($_POST['SubCity_Name_Amharic'])) { $errors[] = "Sub city in amharic should be filled"; } else { $sub_city_name_amharic = $_POST["SubCity_Name_Amharic"]; } if (empty($errors)) { $sub_city = new Sub_City($sub_city_name, $sub_city_name_amharic); if ($encoder_con->Sub_City_Exists($sub_city)) { encoder_place_redirect(Error_Type::SAME_USER_NAME); } $added = $encoder_con->Add_Sub_City($sub_city); /** * inform the encoder about the result */ if ($added) { encoder_redirect_success($sub_city); } else { encoder_place_redirect(Error_Type::DATA_BASE); } } else { encoder_place_redirect(Error_Type::FORM); } }