Hi,
I'm trying to take the values entered in two fields in a given form and perform a calculation with them before storing the result on the database. I'm also trying to set the two field's values to 0 before storing the result.
Currently I'm using the pre_submission_handler hook and I can access my values and calculate them.
What I'm stuck with is how do I then go about setting the values that are going to be submitted to the database to whatever I want.
Being a complete newbie at php I managed to somehow get to this:
add_action("gform_pre_submission", "pre_submission_handler");
function pre_submission_handler($form_meta){
$calculation = (($_POST["input_2"] / $_POST["input_1"]) - 1) * 100;
$_POST["input_3"] = $calculation;
echo $_POST["input_3"];
}
This displays the right calculation but does not store it on the database.
Any help would be greatly appreciated.