public function create() { $template = 'create.php'; /*is_numeric vuelve la variable numerica*/ if ($_SERVER['REQUEST_METHOD'] === 'POST' and is_numeric($_POST['txtCod_ciudad'])) { $rsp = modelClass::putNewCiudad($_POST['txtCod_ciudad'], $_POST['txtNom_ciudad'], $_POST['txtCod_depto'], $_POST['txtHabitantes']); 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); } }