Dynamic page results based on user input

I guess if I was wanting to alter a static page into a more dynamic one without a complete recode, I would still look at using AJAX and MySQLi if you are running a new enough PHP on your server - PDO is better overall to have in your toolbox, but has a tougher learning curve and isn’t as simple to use. There are a ton of tutorials roaming around out there for you to choose from depending on how you learn (I modified this statement below).
Your basic outline of the mechanics is correct. You will have some javascript that collects question answers and sends them to a PHP file on your server. The PHP file then negotiates with your SQL database and sends a payload back to the page. Your on-page JS then updates your page.
If you haven’t dealt with SQL databases before, looking at freecodecamp’s materials would be a great start. Be warned, this is an SQL deep dive, not a lot about hooking it up to the pages, and it is all video. https://www.freecodecamp.org/news/sql-and-databases-full-course/
If you would rather have a more direct hands-on tutorial I would suggest:
https://makitweb.com/like-unlike-using-ajax-jquery-php/
In looking through a fair number of tutorials, I have to admit that most are just ad-serving, click-farmers. Normally I wouldn’t recommend it, but the W3schools pages for AJAX aren’t that bad. Sometimes they are WAY… out of date.
https://www.w3schools.com/xml/ajax_intro.asp
And of course, if you already feel somewhat comfy with the nuts and bolts you can go directly to the developers docs.
AJAX through JS: https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX/Getting_Started
AJAX through jQuery: https://api.jquery.com/jquery.ajax/
MySQLi: https://www.php.net/manual/en/book.mysqli.php
Best of luck - feel free to reach out with more questions if you have them.
RobM (Bob) (Bo)