I'm new to using the Codelgniter Framework, I have a question about how to keep my form data after submitting the page, I'm creating a form with enough fields to fill in, if the user leaves a field blank or writes in a wrong way it will generate a msg error, I wanted the user to have the option to go back in the form and retrieve what was typed.
$this->form_validation->set_rules('nome', 'NOME', 'required|min_length[3]|max_length[40]');
$this->form_validation->set_rules('data_nasc', 'DATA DE NASCIMENTO', 'required');
$this->form_validation->set_rules('rg', 'RG', 'required|exact_length[9]|numeric');
$this->form_validation->set_rules('cpf', 'CPF', 'required|exact_length[11]|numeric');
$this->form_validation->set_rules('sexo_pessoa', 'SEXO DO CLIENTE', 'required|numeric');
$this->form_validation->set_rules('rua', 'RUA', 'required|min_length[4]|max_length[20]|trim');
$this->form_validation->set_rules('numero', 'NUMERO', 'required|max_length[5]|numeric');
$this->form_validation->set_rules('cep', 'CEP', 'required|exact_length[8]|numeric');
$this->form_validation->set_rules('estado', 'ESTADO', 'required|numeric');
$this->form_validation->set_rules('cidade', 'CIDADE', 'required|numeric');
$this->form_validation->set_rules('bairro', 'BAIRRO', 'required|numeric');
$this->form_validation->set_rules('tel1', 'TELEFONE 1', 'required|min_length[10]|max_length[11]|numeric');
$this->form_validation->set_rules('cat_tel1', 'CATEGORIA DO TELEFONE 1', 'required|numeric');
$this->form_validation->set_rules('nome_animal', 'NOME DO ANIMAL', 'alpha|required|min_length[3]|max_length[20]');
$this->form_validation->set_rules('categoria_animal', 'CATEGORIA DO ANIMAL', 'required|numeric');
$this->form_validation->set_rules('raca', 'RAÇA', 'required|numeric');
$this->form_validation->set_rules('sexo_animal', 'SEXO DO ANIMAL', 'required|numeric');
$this->form_validation->set_rules('cor', 'COR', 'required|numeric');
$this->form_validation->set_rules('porte', 'PORTE', 'required|numeric');
$this->form_validation->set_rules('data_nasc_animal', 'DATA DE NASCIMENTO DO ANIMAL', 'required');
if($this->form_validation->run() == FALSE){
if(validation_errors()){
die('<p> <a href="'.base_url('cadastro_cliente').'"> Clique aqui </a> para voltar</p>'.validation_errors());
}
}