Quote from: allanb at Sep 21, 2010, 09:37 PM
Maybe you could post you solution so I and others can learn.
Well, i’ve just had five minutes look at this and the solution (using no.2 saving to sessions) was faster to implement than writing my previous post.
1. Add a formit hook with the following code:
<?php
$_SESSION['last_form'] = $scriptProperties['fields'];
return true;
?>
This saves the form fields into the session. You can change the session key or even make it dynamic.
2. On the confirmation page where the user is redirected, simply make a call to another snippet that has the following code:
<?php
if (isset($_SESSION['last_form']))
{
$modx->setPlaceholders($_SESSION['last_form'], 'fi.');
}
return '';
?>
Again, note the use of the "last_form" key. You can use whatever you want to avoid clashes in the session scope or make it dynamic using a snippet call parameter.
Once this snippet has run, placeholders with names matching the form fields will be available (also note the ’fi’ prefix, again you can choose what you want)
So, on your confirmation page you can just call the snippet as follows:
[[!SessionFormToPlaceholders]]
You submitted:<br>
Name: [[+fi.name]]
There are flaws to this approach and it’s not as robust as it could be but it’s good enough for me for the moment.
I’ve also updated the other thread about saving to the database. It’s easy to combine the two if needed.