mardi 3 décembre 2019

cf7 calculations and if function

I'm trying to achieve a simple solution for a calculation problem. I need to get a specific outcome in the Wordpress-Plugin "Contact Form 7" using this equation (((values1 * values2)+18) * values3 * values4)

Overall the equation brings ok results but I needed to update it. The contact form was used to calculate the insurance value from one insurance giver, but now i have to provide a second outcome from a second company in the same form with more variables.

I've tried this.

[calculation Calculation-field precision:0 roundup "(((values1 * values2)+18) * values3 * values4)"


"fn_php(

if($_POST{'values1'} == 566 && $_POST{'values2'} == 1 && $_POST{'values4'} == 2) return 400;

if($_POST{'values1'} == 566 && $_POST{'values2'} == 1 && $_POST{'values4'} == 3) return 440;

if($_POST{'values1'} == 566 && $_POST{'values2'} == 1 && $_POST{'values4'} == 4) return 480;

if($_POST{'values1'} == 566 && $_POST{'values2'} == 1 && $_POST{'values4'} == 5) return 520;

if($_POST{'values1'} == 566 && $_POST{'values2'} == 1 && $_POST{'values4'} == 6) return 560;


)"]

Obviously it doesnt work.

Thanks in advance and sorry if it's not understandable. I'm almost giving up...

Aucun commentaire:

Enregistrer un commentaire