Hi,
I am trying to use some PHP to take a value from a form input, do some math and produce another value that I can then put into an email action for my form. For example, the person selects 3 items from a drop down on the form. This value is now in {data: numberItems}. In the email action, I want to put some PHP code that will read the number of items and then produce a cost which I can then echo in the email HTML.
I tried this:
<?php
$numberItems = $this->data['numberItems'];
if ($numberItems=1){
$totalAmount =100;
}
if ($numberItems=2){
$total Amount =200;
}
?>
Then in my HTML email, I used this to try to show the total amount owed: <html><p>$<?php echo $totalAmount;?></p></html>
I used the debugger to see what was going on. It doesn't tell me anything. All I see is this at the start of my email: data['numberItems'];
I tried parantheses instead of brackets. I tried $form-> instead of $this-> (but I know this is not for chronoformsv6). This has to be doable. I just must not be accessing the form data correctly.
Please let me know what you think. Thank you in advance for any tips.
Erik
I am trying to use some PHP to take a value from a form input, do some math and produce another value that I can then put into an email action for my form. For example, the person selects 3 items from a drop down on the form. This value is now in {data: numberItems}. In the email action, I want to put some PHP code that will read the number of items and then produce a cost which I can then echo in the email HTML.
I tried this:
<?php
$numberItems = $this->data['numberItems'];
if ($numberItems=1){
$totalAmount =100;
}
if ($numberItems=2){
$total Amount =200;
}
?>
Then in my HTML email, I used this to try to show the total amount owed: <html><p>$<?php echo $totalAmount;?></p></html>
I used the debugger to see what was going on. It doesn't tell me anything. All I see is this at the start of my email: data['numberItems'];
I tried parantheses instead of brackets. I tried $form-> instead of $this-> (but I know this is not for chronoformsv6). This has to be doable. I just must not be accessing the form data correctly.
Please let me know what you think. Thank you in advance for any tips.
Erik