Show custom message based on survey results?

I think i’m very close to an answer but would love a little help to get me across the finish line.

here’s what I’m trying to do:

I’ve created a 3 question survey and I want to show a specific message based on their answers. Each question has two options (option A OR option B - not AND).

Ex. (Q) First off, tell us about your digital space!
(A) I’m just sprouting – no website yet.
(B) I have a website, but it feels like it needs some love.

If they choose (A) I want the confirmation page to show “Based on your answers, this is what you should do… (then output “Sign up for my website plan”)…”

Now, based on this answer ( How to programmatically calculate the frequency of values in option fields [RESOLVED] ) that points to this documentation ( https://docs.gravityforms.com/gform_pre_submission/ ) it seems like I should create a hidden field that will take a custom text string based on their input selection. This way, I could create three hidden fields that will take a custom text string based on their input and then output the three hidden fields on the confirmation page (thus creating my custom tailored recommendations).

However, in this code:

add_action( 'gform_pre_submission', 'pre_submission_handler' );
function pre_submission_handler( $form ) {
    $_POST['input_14'] = 'new value for field 14';
}

I’m having trouble configuring the code to use a conditional statement such as:

if input_1 = (A) then add “custom message” to input_10 and if input_1 = (B) then add “different custom message” to input_10

Then repeat this for input field 2 and 3…

Is that possible? is there a better way?

Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.