Forums

How to subtract two fields and show result in email

spytech 16 Jun, 2018
Hi, I have two fields {price} and {deposit}. I would like to subtract deposit from price and show the value in an email. I assume I need to add some PHP code within the 'SETUP' section that does the calculation and outputs the answer to a field, I can then add the Var to the email.

I have searched the forums and can not find and example of how to write the PHP code.

Any help would be really appreciated.

Thanks. 🙂
healyhatman 16 Jun, 2018
$this->get("varname", "default value if not found"); for things you would get with {var}

$this->data("field", "default"); for {data}
spytech 18 Jun, 2018
Hi, I am looking to subtract the {deposit} field from the {price} field and show the result as a VAR. I am not sure if the code you have provided would do that? Am I missing something?
Thanks
healyhatman 18 Jun, 2018
The code I gave you shows how to get a {var:} or {data:} value, since you can't use shortcode in PHP. Return the value you want, then display it elsewhere using {var:php_action_name}
This topic is locked and no more replies can be posted.