Forums

Session to Variable

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?
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.