Hello everyone,
Fist, I understand this topic is being discussed a lot in this forum. However, I have tried searching for related posts, it seemed that I couldn't find the exact solution.
The question is simple, how to use "Data to Session" and "Session to Data" across two or more forms?
I did try to play around these two actions.
Suppose I have first form "register-p1-form" and add "Data to Session" action into the form's "OnSubmit" event. I also configure the "Data to Session" and put "BASIC_INFO" as the session key.
Then I create second form "register-p2-form" and add "Session to Data" action into the form's "OnLoad" event. Now how do I get the data with the key "BASIC_INFO" in the session using PHP. (or how do I get the data from the previous form)
I wrote the php code just after "Session to Data" action as follows:
This code snippet output nothing in "register-p2-form". So how should I use "D2S" and "S2D" correctly and be able to get the value (e.g. value in 'username' field ) from the previous form?
I really appreciate any kind suggestions. Cheers!
Fist, I understand this topic is being discussed a lot in this forum. However, I have tried searching for related posts, it seemed that I couldn't find the exact solution.
The question is simple, how to use "Data to Session" and "Session to Data" across two or more forms?
I did try to play around these two actions.
Suppose I have first form "register-p1-form" and add "Data to Session" action into the form's "OnSubmit" event. I also configure the "Data to Session" and put "BASIC_INFO" as the session key.
Then I create second form "register-p2-form" and add "Session to Data" action into the form's "OnLoad" event. Now how do I get the data with the key "BASIC_INFO" in the session using PHP. (or how do I get the data from the previous form)
I wrote the php code just after "Session to Data" action as follows:
<?php
$session =& JFactory()::getSession();
$form = $session->get("BASIC_INFO");
echo $form->data['username'];
?>
This code snippet output nothing in "register-p2-form". So how should I use "D2S" and "S2D" correctly and be able to get the value (e.g. value in 'username' field ) from the previous form?
I really appreciate any kind suggestions. Cheers!