public function create() { $template = 'create.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $anwr = modelClass::newFicha($_POST['txtNum'], $_POST['txtPrograma'], $_POST['txtIni'], $_POST['txtFin'], $_POST['txtCentro']); if ($anwr === true) { $args['success'] = 'Su registro ha sido exitoso!'; $this->index($args); } else { $args['error'] = $anwr->getMessage(); $args['formAction'] = 'index.php?action=create'; $args = array_merge($args, $_POST); viewClass::renderHTML($template, $args); } } else { $args['formAction'] = 'index.php?action=create'; viewClass::renderHTML($template, $args); } }