Hello,
I am trying to populate similar form fields with data filled by the user on an earlier form so when the user is directed to a next form he does not find an empty form but what fields he filled earlier are already pre-filled. Here is the code that would go at the top of the page:
I am not able to get it to work. Has anyone at the forum worked with sessions. i would appreciate suggestions.
Thanks in advance.
Ron
I am trying to populate similar form fields with data filled by the user on an earlier form so when the user is directed to a next form he does not find an empty form but what fields he filled earlier are already pre-filled. Here is the code that would go at the top of the page:
session_start();
$_SESSION['region'] = $region; //use $_POST[''] or whatever to collect this information from form
$_SESSION['country'] = $country;
$_SESSION['city_state'] = $city_state;
$_SESSION['fullname'] = $fullname;
$_SESSION['address1'] = $address1;
$_SESSION['address2'] = $address2;
$_SESSION['city'] = $city;
$_SESSION['zip'] = $zip;
$_SESSION['email'] = $email;
$_SESSION['phone'] = $phone;
if(isset($_POST['save']))
{
if ($_POST['valid']=="true")
{
$region = $pageForm.region.value;
$country = $_POST['country'];
$_SESSION['city_state'] = $_POST['city_state'];
$fullname = $_POST['fullname'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$email = $_POST['email'];
$phone = $_POST['phone'];
if(!get_magic_quotes_gpc())
{
// if there are not slashes around the variable data, put them around the infomation to enable it to be entered into
// the database correctly
$region = addslashes($_POST['region']);
$country = addslashes($_POST['country']);
$city_state = addslashes($_POST['city_state']);
$fullname = addslashes($_POST['fullname']);
$address1 = addslashes($_POST['address1']);
$address2 = addslashes($_POST['address2']);
$city = addslashes($_POST['city']);
$zip = addslashes($_POST['zip']);
$email = addslashes($_POST['email']);
$phone = addslashes($_POST['phone']);
print_r($_SESSION);
}
}
}
I am not able to get it to work. Has anyone at the forum worked with sessions. i would appreciate suggestions.
Thanks in advance.
Ron
Hi Ron,
I CnronoForms v3 the Multi-page plug-in uses sessions to pass the data between pages; in CFv4 there are 'Data to Session' and 'Session to Data' actions that you can use. Joomla! also has session methods that are easy to use in PHP.
Bob
I CnronoForms v3 the Multi-page plug-in uses sessions to pass the data between pages; in CFv4 there are 'Data to Session' and 'Session to Data' actions that you can use. Joomla! also has session methods that are easy to use in PHP.
Bob
Thanks for the answer bob.
I tried the Data to session and session to data but seems to not work for me. Maye be I have made a mistake some where, but most of my forms are custom hope that is not the reason it not working for me.
I am going to have a look again. Your views are highly appreciated.
UPDATE 10 minutes later:The Data to session and session to data does not work for me. I do not know where I may be going wrong.
thanks a lot
Ron
I tried the Data to session and session to data but seems to not work for me. Maye be I have made a mistake some where, but most of my forms are custom hope that is not the reason it not working for me.
I am going to have a look again. Your views are highly appreciated.
UPDATE 10 minutes later:The Data to session and session to data does not work for me. I do not know where I may be going wrong.
thanks a lot
Ron
Hi Ron,
Make sure that you use the same Session Key on both actions. It defaults to the form name and that will be different.
Bob
Make sure that you use the same Session Key on both actions. It defaults to the form name and that will be different.
Bob
Hello Bob,
I get the following error when I debug the system:
Array
(
[option] => com_chronoforms
[chronoform] => testing
[Itemid] =>
)
Any Suggestions
Thanks
Ron
I get the following error when I debug the system:
Array
(
[option] => com_chronoforms
[chronoform] => testing
[Itemid] =>
)
Any Suggestions
Thanks
Ron
Hi Ron,
Is the debugger at the end of the ON Load action?
If so then your Session Data is either not being saved or not being recovered.
Bob
Is the debugger at the end of the ON Load action?
If so then your Session Data is either not being saved or not being recovered.
Bob
Bob,
I put the debugger at the end at the beginning in the middle in the on submit but no change. The form does not display either only the debug code is visible.
Thanks
Ron
I put the debugger at the end at the beginning in the middle in the on submit but no change. The form does not display either only the debug code is visible.
Is the debugger at the end of the ON Load action?
If so then your Session Data is either not being saved or not being recovered.
Thanks
Ron
Hello Bob,
Sorry.. But I did not find where is session action settings.๐คจ Please advise.
Thanks
Ron
Sorry.. But I did not find where is session action settings.๐คจ Please advise.
Thanks
Ron
Hi Ron,
Sorry, I meant the settings for the 'Data to Session' and 'Session to Data' actions.
Bob
Sorry, I meant the settings for the 'Data to Session' and 'Session to Data' actions.
Bob
Bob !
Where are these settings ? I am sorry there is no setting for data to sessions and sessions to data actions. Maybe I am over looking these.
As suggested I did accordingly: But I can't see it anywhere..
Please help
Ron
Where are these settings ? I am sorry there is no setting for data to sessions and sessions to data actions. Maybe I am over looking these.
As suggested I did accordingly: But I can't see it anywhere..
To install this action unzip the file and copy the files to the administrator/components/com_chronoforms/form_actions/load_user_info_gh folder on your site.
Please help
Ron
Hi Ron,
Yes there are; and, as I said earlier, you must set the same Session Key in both actions.
Bob
Yes there are; and, as I said earlier, you must set the same Session Key in both actions.
Bob
Bob..
Thanks for the reply. This is something that I did much earlier. I was thinking there are more setting apart from this ๐ and on both the forms I have same settings
Thanks for the reply. This is something that I did much earlier. I was thinking there are more setting apart from this ๐ and on both the forms I have same settings
This topic is locked and no more replies can be posted.