How can I add data to table column from Session Data

Discuss MySQL Ajax Table Editor

How can I add data to table column from Session Data

Postby RageInvader » Thu Sep 11, 2014 1:24 pm

I have a simple login already setup on my site, and I am trying to insert the Username of the person logged in on a column in the table called "user_add"

Is this possible?
RageInvader
 
Posts: 2
Joined: Thu Sep 11, 2014 1:15 pm

Re: How can I add data to table column from Session Data

Postby admin » Thu Sep 11, 2014 3:16 pm

You can set the default value to your session username variable and then make the field hidden on the add screen. To do this you can use the hidden_add and default options.

Another way to do this is with the on_add_fun callback function.
admin
Site Admin
 
Posts: 1502
Joined: Fri Jul 11, 2008 1:34 am

Re: How can I add data to table column from Session Data

Postby RageInvader » Thu Sep 11, 2014 4:18 pm

I tried this, but it didn't seem to work.. the field was always blank.
Where $userName is the variable
Code: Select all
      $tableColumns['user_add'] = array(
         'display_text' => 'Added by',
         'perms' => 'EVCTAXQSHO',
         'hidden_add' => true,
         'default' => $userName,
      );
RageInvader
 
Posts: 2
Joined: Thu Sep 11, 2014 1:15 pm


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 11 guests

cron