Hi everyone,
I developed a class in which i have to display a form. Thus I inserted the following lines in my form to unlist records.
try{ $output =$this->grocery_crud->render(); } catch(Exception $e) { if($e->getCode() == 14) { redirect(strtolower(__CLASS__).'/'.strtolower(__FUNCTION__).'/add') ; } else { show_error($e->getMessage()); } }
this form is functional 100% in my local machine . Unfortunately when i tried to host it in the web the system inform me that the page is not found (error 404 ) . I have tried to debug the code and i found that the bugging line is :
redirect(strtolower(__CLASS__).'/'.strtolower(__FUNCTION__).'/add') ;
Could you help me to resolve this pb plz !!
Below the total class :
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class UserAdmin extends CI_Controller { function __construct() { parent::__construct(); session_start(); $this->load->database(); $this->load->helper('url'); $this->load->library('grocery_CRUD'); } public function index() {} public function personne() { $this->session->set_userdata('sectionName', 'Personne'); $this->grocery_crud->set_table('personne'); $this->grocery_crud->set_relation('idGroupe','groupe','nomGroupe'); $this->grocery_crud->columns('cin', 'prenom', 'nom','numTel','dateNaissance','email','Sexe','idGroupe'); $this->grocery_crud->fields('cin', 'prenom', 'nom','numTel','dateNaissance','email','Sexe','idGroupe'); $this->grocery_crud->required_fields('cin', 'prenom', 'nom','numTel','dateNaissance','Sexe'); $this->grocery_crud->display_as('cin','CIN'); $this->grocery_crud->display_as('prenom','prénom'); $this->grocery_crud->display_as('Nom','Nom'); $this->grocery_crud->display_as('numTel','Tel'); $this->grocery_crud->set_subject('personne'); $this->grocery_crud->display_as('dateNaissance','Date de Naissance'); $this->grocery_crud->set_rules('email', 'Email', 'trim|required|valid_email'); $this->grocery_crud->display_as('idGroupe','Groupe'); $this->grocery_crud->callback_field('numTel',array($this ,'edit_numTel')); $this->grocery_crud->callback_after_insert(array($this, 'after_insert')); $this->grocery_crud->set_theme('datatables'); $this->grocery_crud->unset_back_to_list(); try{ $output =$this->grocery_crud->render(); } catch(Exception $e) { if($e->getCode() == 14) { redirect(strtolower(__CLASS__).'/'.strtolower(__FUNCTION__).'/add') ; } else { show_error($e->getMessage()); } } $this->load->view('tbo/index.html',$output); } } ?>