public function create() { $args['depto'] = modelClass::getDepto(); $template = 'create.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $rsp = modelClass::newCity($_POST['codCity'], $_POST['nameCity'], $_POST['txtDepto'], $_POST['txtHabi']); if ($rsp === true) { $args['success'] = 'El registro fue realizado exitosamente'; $this->index($args); } else { $args['error'] = $rsp->getMessage(); $args['formAction'] = 'index.php=create'; $args = array_merge($args, $_POST); viewClass::renderHTML($template, $args); } } else { $args['formAction'] = 'index.php?action=create'; viewClass::renderHTML($template, $args); } }