0
I am beginner with the use of Codelgniter Framework, I have a doubt how to keep the data of my forms after submitting the page, I am creating a form with many fields to be filled, if the user leaves a blank field or misspelling it will generate an error msg, I wanted the user to have the option to return to the form and rescue 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());
}
}