Forums

[SOLVED] $form->data[] doesn't work in thanks message

dmontpe 13 Jul, 2011
I want to manipulate some variables using PHP to show them in a particular way in a thanks message but when I try to use $form->data['input'] the code gets truncated. For instance, if I add...

<?php echo $form->data['input']; ?>


My thank you message displays:

data['input']; ?>



Is the $form->data[] array lost after it is saved to the db?


David
dmontpe 13 Jul, 2011
Just to add something, it looks to me more like the '>' in '$form->data' is being interpreted as closing the php end tag. Weird...



David
GreyHead 14 Jul, 2011
Hi David,

I agree - What is the entire code you have there?

It may be easier to do the manipulation in a Custom Code action
<?php
$form->data['new_var'] = a + b;
?>
and then just use the results in the template using {new_var}

Bob
dmontpe 14 Jul, 2011
Thanks, Bob. You advice was useful, as usual. I placed the code as a custom code and php is not a problem anymore.

However, I'm still running into a problem: how can I retrieve the cf_id of the record that was just saved? I realized cf_id and cf_uid are not part of the $form->data array, so how can I get any of them back? I just want to say something like "your record number is XXXX" in the thanks message.


David


P.S. I got the AJAX code and tutorial. Thank you. I'll let you know as soon as I get to test it.
GreyHead 17 Jul, 2011
Hi David,

ChronoForms saves the 'saved data' in the $form->data array as $form->data['model_id']; if you haven't specifed a model id then the default value is $form->data['chronoform_data']

Bob
dmontpe 18 Jul, 2011
Got it! Thanks.
This topic is locked and no more replies can be posted.