Parse user’s responses for display

Hey everyone, I have developed a web site for a local cancer hospital in Houston. The web site is targeted at survivors of colorectal cancer who are interested in taking up an exercise routine. The website makes recommendations that the user should consider based on their general health, age and overall fitness.

My Gravity form is built and works fine. The user goes through and answers 28 questions. Some of the questions are radio buttons, others are Yes-No. All questions must be answered to submit.

Once the user submits their responses, the system will display a set of exercise recommendations. Some of the recommendations depend on a combination of responses.

I know that I can do various confirmation pages where I add the various variables to the logic to display one page or another. But with 28 questions, the number of confirmation pages necessary to meet all combinations of conditions becomes geometrically huge.

I need a solution that allows me to write the logic in PHP or in JavaScript and embed that in a template. That logic would then have a number of algorithms that would determine if a content element should be displayed. I’d like to point the confirmation to that page and have it parse the record and display the content.

For the life of me I can’t see where to learn how to do this! I’m an old Cold Fusion programmer so the model in my head is probably archaic. Can ANYONE give some insight in how to solve this??

Thank you!!!