Hello Everybody,
I'm struggling with a problem, I tried several ways to accomplish this with no lucky.
I need to pass a value: tbl_asegurado_fenixid to the add form. I have this value already saved in a $_Session ... but don't know why isn't populate on the DB...
This is my code,
public function index()
{
$this->global['pageTitle'] = 'Fenix : Mis Fenix';
$fenixidget =$this->input->get('fenixid');
$this->session->set_userdata('fenixid', $fenixidget);
echo $_SESSION['fenixid'];
$this->cargarasegurados();
}
public function cargarasegurados()
{
$crud = new grocery_CRUD();
echo $id_insertar;
$crud->set_theme('datatables');
$crud->set_table('asegurado');
$crud->set_subject('Asegurados');
//$crud->unset_add();
$crud->unset_clone();
$crud->unset_delete();
$crud->unset_export();
$crud->unset_print();
$crud->columns('tbl_asegurado_fenixid','tbl_asegurado_nombre',
'tbl_asegurado_dni','tbl_asegurado_catastro','tbl_asegurado_telefono');
$crud->fields('tbl_asegurado_fenixid','tbl_asegurado_nombre',
'tbl_asegurado_dni','tbl_asegurado_catastro','tbl_asegurado_telefono');
$crud->field_type('tbl_asegurado_fenixid', 'hidden', $_SESSION['fenixid']);
//$crud->display_as('tbl_asegurado_fenixid','Fenix_ID');
$crud->where('tbl_asegurado_fenixid', $_SESSION['fenixid']);
$output = $crud->render();
$this->global['pageTitle'] = 'Fenix : Asegurados';
$this->loadViews("asegurados",$this->global,$output,"NULL");
}
The session is working fine for the WHERE condition.
Any help will be higly appreciated!
Regards,
Pablo
--- Added Information ---
I've also tried with the following code
$crud->callback_add_field('tbl_asegurado_fenixid',function(){
return '<input type="text" maxlength="50" value="'. $_SESSION['fenixid'] .'" name="tbl_asegurado_fenixid
">'; });
