Session to Variable

Access session data in a ChronoForms PHP variable.

Overview

The issue occurs when trying to retrieve session data directly using an incorrect PHP array syntax.
Use the provided session getter method to correctly access the session value and assign it to a PHP variable.

Answered
ChronoForms v6
om omidhz 13 Jul, 2017
I have two forms. Form 1 sends data to form 2 via session called "create_responce".
In form 2, I am able to retrieve the field value "response_ID" using the session in a hidden field by using
{session:create_responce.responce_ID}


However, I like to make a variable in php without using a hidden field in my form. I used the following code in my php but it is not working.

$responce_ID = $this->session['create_responce']['responce_ID'];


Any idea how can I set my new variable in php?
om omidhz 14 Jul, 2017
Answer
Ok, I found the answer. If you are looking for the same, here is the code that can be used:
\GApp::session()->get("session_name.var", "default"); 

So, in my case, it is going to be
$response_ID = \GApp::session()->get("create_responce.responce_ID"); 
This topic is locked and no more replies can be posted.