Correct Syntax for PHP in Display Message

JerseyGirl 30 Jun, 2016
Hi,
I would like to put some data from the form into the display message after form submission, similar to what I do with emails.

If I just copy the code from my email action to my display message action, the html displays properly but I the PHP I wrote for email doesn't work in the display message - a portion of the actual code is displayed in the browser.

Here's a simple statement that does what I want for email but not in display message:
<?php
if ($_REQUEST['apples'] == 1)
{
echo 'I want 1 apple.';
}
elseif ($_REQUEST['apples'] > 1)
{
echo 'I want more than 1 apple.';
}
?>
"apples" is a dropdown with values of 1, 2, or 3.

I tried switching $_REQUEST to $form->data (based on something I read in FAQ) but that didn't seem to help.

What would be the correct syntax for this?

Thanks!!
JerseyGirl 07 Jul, 2016
Can anyone help me? Still can't figure this out by guessing... Thanks.
GreyHead 07 Jul, 2016
Hi JerseyGirl,

For some reason - possibly because of the Rich Text Editor - the Display Message action doesn't support PHP. Use a Custom Code action in the same location and the PHP should work OK.

Bob

PS ChronoForms adds all the $_REQUEST variables into the $form->data array so you can also use $form->data['apples']
This topic is locked and no more replies can be posted.