⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

adding a record with preset field value



richb201

richb201
  • profile picture
  • Member

Posted 21 January 2019 - 16:16 PM

I have a table which uses where

 

$crud->set_table('campaigns2');

$crud->where('email', $this->session->userdata('userid'));

 

This displays the table fine. 

When a user wants to add another record they press "Add a new Campaign". This adds a record, but the email field is blank in phpmyadmin. btw, I have set the email field to invisible.

 

$crud->change_field_type('email', 'invisible');

 

I tried using

$crud->callback_add_field('email', function () {
          return '$this->session->userdata('userid')) <input type="text" maxlength="50" value="" name="email">';
});

 

but it doesn't work. What am I doing wrong?


richb201

richb201
  • profile picture
  • Member

Posted 21 January 2019 - 21:42 PM

never mind. I figured it out by using 

 

$crud->field_type('email', 'hidden', $this->session->userdata(userid));