Email action template - can`t get data from form-array

brostalski 22 Jun, 2012
Hi,

i have a problem with my mail action. 1. mail sends data correct (use {fieldname} to get form data).
The 2. mail have php code in the template.

Follow dosn't work:
<?php
$variable = {fieldname};

if($variable == "xyz") {
$variable2 = "yes";
} else {
$variable2 = "no";
}
?>
some Text here... <?php echo $variable2; ?>... some Text here too.


Can someone help? With print_r($data) or print_r($form) i get the formdata but no values from User!
GreyHead 23 Jun, 2012
Hi brostalski,

You usually can't use the {} with PHP because the PHP is run before the {} replacements. To access form data from PHP use the $form->data array. So, in your code you need to replace $variable = {fieldname}; with $variable = $form->data['fieldname'];

Please see this FAQ for more info.

Bob
brostalski 23 Jun, 2012
Hi GreyHead,

thats so easy and i'll find nothing by google.
Thanks!

Greetz
brostalski
This topic is locked and no more replies can be posted.