Insert PHP session variables to database on inline editor submit

Insert PHP session variables to database on inline editor submit

bbrindzabbrindza Posts: 316Questions: 73Answers: 1

How would I insert PHP session variables such as User ID when user enters and submits data in inline editor.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Use the Field->setValue() method:

    Field::inst( 'myField' )
      ->setValue( $_SESSION['mySessionVar'] )
    

    Allan

  • bbrindzabbrindza Posts: 316Questions: 73Answers: 1

    Thank You Allan!

  • FreedeeFreedee Posts: 1Questions: 0Answers: 0

    Hi Allan,
    thank you for your wonderful work.
    Unfortunately, the solution you have shown leads to an error message for me.
    Undefined variable: _SESSION ...
    Of course I defined one and I didn't destroy it.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you show me the full error message please? Also, did you call session_start() before that line would run?

    Allan

This discussion has been closed.