I have the following code which produces a registration form. It works fine on the page load but on POSTing it tells me that CI_formgenerator cannot be found - even though I've clearly not called the function that. What am I doing wrong?
Code:
public function index(){
$this->benchmark->mark('code_start');
$this->load->library('formgenerator',array('register'));
$this->formgenerator->setupValidation();
if ($this->form_validation->run() == FALSE){
if (count($_POST)){
$this->formgenerator->populateForm($_POST);
} else {
$sample_data = array();
$this->formgenerator->populateForm($sample_data);
}
$form_out = $this->formgenerator->generateForm();
$this->benchmark->mark('code_end');
$this->benchmark->elapsed_time('code_start', 'code_end').'<br>';
$this->CI->autocontent['form'] = '<ul>'.implode($form_out).'</ul>'; // Autocontent can be an array of variables!
} else {
$this->load->library('formgenerator',array('register'));
$this->load->model('register');
$this->register->saveUser($_POST);
echo 'Your registration has been successful. Please confirm your account in your email';
}
}
The full error I get is:
A PHP Error was encountered
Severity: Error
Message: Class 'CI_Formgenerator' not found
Filename: core/Common.php
Line Number: 196
Backtrace:
{With no backtrace available}