Hi there,
My form is working just fine and I am using the redirect url to go to a thank you page. I would like to have some variables from the form on the thank you page such as:
You requested date is: $_POST['date']
Also, so I can show a link to new patient forms if they have selected 'Yes' from a question in the form. I can't figure out how I get use these variables in my thank you page.
Please help.
My form is working just fine and I am using the redirect url to go to a thank you page. I would like to have some variables from the form on the thank you page such as:
You requested date is: $_POST['date']
Also, so I can show a link to new patient forms if they have selected 'Yes' from a question in the form. I can't figure out how I get use these variables in my thank you page.
Please help.
Hi,
Since you redirect, there's no practical way to attach form data to the redirect, other than "GET-style" URL-encoding them. To do this with ChronoForms, you'd have to use some custom code, as the Redirect-control in the form setup does not allow dynamic values to be entered.
The following code will add a parameter named 'date', containing the value of the previously submitted parameter 'date', to the URL stored in the Redirect control. It should be added to the "on Submit - after email" control.
/Fredrik
Since you redirect, there's no practical way to attach form data to the redirect, other than "GET-style" URL-encoding them. To do this with ChronoForms, you'd have to use some custom code, as the Redirect-control in the form setup does not allow dynamic values to be entered.
The following code will add a parameter named 'date', containing the value of the previously submitted parameter 'date', to the URL stored in the Redirect control. It should be added to the "on Submit - after email" control.
<?
$url = JFactory::getURI($MyForm->formrow->redirecturl);
$url->setVar('date', JRequest::getVar('date', '', 'post'));
$MyForm->formrow->redirecturl = $uri->toString();
?>
/Fredrik
Is there a way to add these vars to the session and then read those variables from the thank you page and then drop them from the session after they've been written to the page?
Buddy
Buddy
Hi,
As long as you're redirecting within the same site, the session storage should work very well.
To store the data:
To retrieve the data stored:
To remove the data from the session storage:
/Fredrik
As long as you're redirecting within the same site, the session storage should work very well.
To store the data:
<?
$sess =& JFactory::getSession();
$sess->set('date', JRequest::getVar('date', '', 'post'));
?>
To retrieve the data stored:
<?
$sess =& JFactory::getSession();
$date =& $sess->get('date', '');
?>
To remove the data from the session storage:
<?
$sess =& JFactory::getSession();
$sess->clear('date');
?>
/Fredrik
This topic is locked and no more replies can be posted.