public function create() { $template = 'create.php'; $args['rh'] = modelClass::getRh(); $args['ciudad'] = modelClass::getCiudad(); $args['TID'] = modelClass::getTid(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { $anwr = modelClass::newAprendiz($_POST['txtId'], $_POST['txtNombre'], $_POST['txtApellido'], $_POST['txtTel'], $_POST['idCiudad'], $_POST['idRh'], $_POST['idTipoId'], $_POST['txtGenero'], $_POST['txtEdad']); if ($anwr === true) { $args['success'] = 'The Registration Was SUCCESSFUL!'; $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); } }