Forums

The sum of the selected options

mastek 31 Mar, 2013
Hi there,

I'm beginner with ChronoForms and PHP and i need some help with simple form.

Can you explain to me step by step how to calculate this exemplary form -> http://www.carway.lexcom.pl/index.php/zliczanie using options Form Wizard on ChronoForms

I will be very grateful for any tips
GreyHead 31 Mar, 2013
Hi mastek,

You could do it after the form Submits using a Custom Code action with PHP like this:
<?php
$form->data['total'] = $form->data['input_checkbox_4'] + $form->data['input_checkbox_5'] + $form->data['input_radio_6'] + $form->data['input_select_7'];
?>
Then you could add {total} in an Email or Thank You Page action.

Bob
mastek 02 Apr, 2013
Thank you Bob, now I can easily do more complex forms.
zsteven1 18 Jun, 2013
Thanks for this solution. I was searching for something like this and I'm glad I found it.

Is it also possible to make the {total} an amount? For example:

When I calculate € 1.95 * 2, total will be € 3.9
I want te be the total displayed as € 3.90
Is this possible?
This topic is locked and no more replies can be posted.