/** * get the user name from post */ if (empty($_POST['Wereda_Name'])) { $errors[] = "City should be filled"; } else { $wereda_name = $_POST['Wereda_Name']; } if (empty($_POST['Wereda_Name_Amharic'])) { $errors[] = "Wereda in amharic should be filled"; } else { $wereda_amharic = $_POST["Wereda_Name_Amharic"]; } if (empty($errors)) { $wereda = new Wereda($wereda_name, $wereda_amharic); if ($encoder_con->Wereda_Exits($wereda)) { encoder_place_redirect(Error_Type::SAME_USER_NAME); } $added = $encoder_con->Add_Wereda($wereda); /** * inform the encoder about the result */ if ($added) { encoder_redirect_success($wereda); } else { encoder_place_redirect(Error_Type::DATA_BASE); } } else { encoder_place_redirect(Error_Type::FORM); } }