public function create() { $template = 'create.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST' and is_numeric($_POST['txtId_apre'])) { $rsp = modelClass::putNewAprendiz($_POST['txtId_apre'], $_POST['txtNom_apre'], $_POST['txtApel_apre'], $_POST['txtTel_apre'], $_POST['txtCod_ciudad'], $_POST['txtCod_tipo_id'], $_POST['txtCod_rh'], $_POST['txtGenero'], $_POST['txtEdad']); if ($rsp === true) { $args['success'] = 'El registro fue realizado exitosamente'; $this->index($args); } else { $args['error'] = $rsp->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); } }