[eluser]Ray Luevano[/eluser]
Esto es solo por compartir la ayuda que me brindo jozeunico :-)
la vista
Code:
<html>
<head>
<title>Welcome to CodeIgniter</title>
</head>
<body>
<?php
echo form_open('validar');
$data = array('name'=>'nombre', 'id'=>'nombre');
echo 'Nombre:'.form_input($data);
$data = array('name'=>'telefono', 'id'=>'telefono');
echo 'Telefono:'.form_input($data);
echo form_submit('submit','Validar');
echo form_close();
?>
</body>
</html>
Controlador (Validacion)
Code:
<?php
class Validar extends Controller {
function Validar()
{
parent::Controller();
}
function index()
{
$this->load->library('form_validation');
$this->load->view('welcome_message');
$this->form_validation->set_rules('nombre', 'El nombre', 'required');
$this->form_validation->set_rules('telefono', 'El telefono', 'required|numeric|integer');
if ($this->form_validation->run() == FALSE)
{
echo "ERROR";
echo validation_errors();
}
else
{
echo "exito";
}
}
}
Controlador (Vista)
Code:
<?php
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
}
function index()
{
$this->load->helper('form');
$this->load->view('welcome_message');
}
}
?>