estoy haciendo un ejercicio luego de haber visto un tutorial, la idea es validar un formulario. Pero al ejecutarlo así: http://localhost/CesdeCodeIgniter/index.php/cliente/formulario_cliente
Me devuelve 404 Page Not Found
El controlador cliente.php
<?php
class cliente extends CI_Controller{
function __construct(){
parent::__construct();
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
}
function mostrarDatos(){
$this->form_validation->set_rules('texDocumentoDeIdentidad', 'Documento de identidad', 'trim|required|max_length[12]');
$this->form_validation->set_rules('texPassword', 'Password', 'trim|required|min_length[3]');
$this->form_validation->set_rules('texNombre', 'Nombre', 'trim|required|min_length[3]|max_length[30]');
$this->form_validation->set_rules('texApellido', 'Apellido', 'trim|required|min_length[3]|max_length[30]');
$this->form_validation->set_rules('texDireccion', 'Dirección', 'trim|min_length[10]|max_length[30]');
$this->form_validation->set_rules('texTelefono', 'Teléfono', 'trim|min_length[7]|max_length[12]');
$this->form_validation->set_rules('texFechaIngreso', 'Fecha de ingreso', 'trim|required|min_length[8]|max_length[12]');
$this->form_validation->set_rules('texEstado', 'Estado', 'trim|required|min_length[5]|max_length[16]');
if($this->form_validation->run()==FALSE){
$this->load->view('formulario_cliente');
}
else{
$datos=array(
'documentoDeIdentidad' => $this->input->post('texDocumentoDeIdentidad'),
'password' => $this->input->post('texPassword'),
'nombre' => $this->input->post('texNombre'),
'apellido' => $this->input->post('texApellido'),
'direccion' => $this->input->post('texDireccion'),
'telefono' => $this->input->post('texTelefono'),
'fechaIngreso' => $this->input->post('texFechaIngreso'),
'estado' => $this->input->post('texEstado')
);
$this->load->view("formulario_cliente", $datos);
}
}
}
?>
La vista formulario_cliente.php
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<TITLE></TITLE>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>/css/estilos.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>/css/bootstrap.min.css">
</head>
<body>
<br>
<div class="container-fluid">
<br>
<div class="row">
<div class="col-md-10">
<ul class="nav nav-pills">
<li role="presentation" ><a href="index.php">Inicio</a></li>
<li role="presentation" class="active"><a href="cliente.php">Cliente </a></li>
<li role="presentation"><a href="cuentaxcliente.php">Cuenta Cliente</a></li>
<li role="presentation"><a href="transaccuenta.php">Transac Cuenta</a></li>
<li role="presentation"><a href="tipotransaccion.php">Tipo de Transacción</a></li>
</ul>
</div>
</div>
</div>
<br><br><br>
<h2 align='center'>Cliente</h2>
<div id="error">
<?php
echo validation_errors();
?>
</div>
<br>
<?php
echo form_open('cliente/mostrarDatos');
?>
Documento de identidad
<input type="text" name="texDocumentoDeIdentidad" id="texDocumentoDeIdentidad" value="<?php echo set_value('texDocumentoDeIdentidad', '');?>"/>
<br>
Password
<input type="text" name="texPassword" id="texPassword" />
<br>
Nombres
<input type="text" name="texNombres" id="texNombres" value="<?php echo set_value('texNombres', '');?>"/>
<br>
Apellidos
<input type="text" name="texApellidos" id="texApellidos" value="<?php echo set_value('texApellidos', '');?>"/>
<br>
Dirección
<input type="text" name="texDireccion" id="texDireccion" value="<?php echo set_value('texDireccion', '');?>"/>
<br>
Teléfono
<input type="text" name="texTelefono" id="texTelefono" value="<?php echo set_value('texTelefono', '');?>"/>
<br>
Fecha de ingreso
<input type="text" name="texFechaDeIngreso" id="texFechaDeIngreso" value="<?php echo set_value('texFechaDeIngreso', '');?>"/>
<br>
Estado
<input type="text" name="texEstado" id="texEstado" value="<?php echo set_value('texEstado', '');?>"/>
<br>
<input type="submit" name="buscarCliente" value="Buscar Cliente" />
<input type="reset" name="limpiar" value="Limpiar" />
<?php
echo form_close();
?>
<br>
<div id="resultado">
<?php
if(!empty($documentoDeIdentidad) && !empty($password) && !empty($nombre) && !empty($apellido) && !empty($fechaIngreso) && !empty($estado)){
echo "Documento de identidad: $documentoDeIdentidad<br>";
echo "Password: $password<br>";
echo "Nombre: $nombre<br>";
echo "Apellido: $apellido<br>";
echo "Dirección: $direccion<br>";
echo "Teléfono: $telefono<br>";
echo "Fecha de ingreso: $fechaIngreso<br>";
echo "Estado: $estado<br>";
}
?>
</div>
</body>
</html>
En el config
$config['base_url'] = 'http://localhost/CesdeCodeIgniter';
En routes
$route['default_controller'] = 'cliente';