2
I’m following a course and stopped at a problem that I can’t solve. In this link it is possible to register a user and when finishing the registration he should go to this 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'] = '';
Php user.
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');
}
}
IS 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 as much as they were not, I think it redirects in the same way. Why is it not redirecting, is sending that page pro 404?