Skip to content

Save stored value in PHP Session when inserting

I need to pass a SESSION var through when I insert a record. I can't find somewhere that I can do this. Is it possible? 
eg :I'm showing the following 2 fields: SubjectLine and Memo. 
when the client hits save I want to trap the logged in users name (which is stored in $_SESSION['uname'] and $uName) and have it inserted into the field uName in the DB. 
I cant do this with triggers as I cant pass PHP vars into a trigger.

The solution is simple if uName in the same table as SubjectLine and Memo. Use set_col_default() method to set the session login name, then hide it using set_col_hidden(). When submit, the "secret" field will be saved as well.  

If they are in different table, then use add_event() method (, create event handler for 


Then, Use jQuery ajax to call a separate script (you must supply your own) that saves the login name stored in session. 

Feedback and Knowledge Base