Jump to content


adding a record with preset field value

add field

  • Please log in to reply
1 reply to this topic

#1 richb201

richb201

    Advanced Member

  • Members
  • PipPipPip
  • 69 posts

Posted 21 January 2019 - 04: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?



#2 richb201

richb201

    Advanced Member

  • Members
  • PipPipPip
  • 69 posts

Posted 21 January 2019 - 09:42 PM

never mind. I figured it out by using 

 

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







Also tagged with one or more of these keywords: add field

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users