I'm following a course and stopped at a problem I can not solve. In this link it is possible to register a user and when finishing the registration he should go to this one page but the only thing that happens is a 404 error.
routes.php
$route['default_controller'] = 'dashboard';
$route['usuario/{:num}'] = "usuario/index/$1";
$route['404_override'] = '';
User.php
TRE INSERTING IN THE BANK
public function cadastrar()
{
$data['nome'] = $this->input->post('nome');
...
if( $this->db->insert('usuario', $data) ){
redirect('usuario/1');
} else {
redirect('usuario/2');
}
}
NOT REDIRECTING
public function index($indice=null)
{
$this->load->view('includes/html_header');
$this->load->view('includes/menu');
if($indice==1){
$data['msg'] = "Usuário foi cadastrado com sucesso";
$this->load->view("includes/msg_sucesso", $data);
} elseif ($indice==2) {
$data['msg'] = "Não foi possível cadastrar o usuário. Tente novamente.";
$this->load->view("includes/msg_erro", $data);
}
$this->load->view('listar_usuario');
$this->load->view('includes/html_footer');
}
The includes are also correct and even though they were not, I think it redirects in the same way. Because it will not be redirecting, you are sending this page pro 404?