Skip to content
Advertisement

How to filed form fields based upon user selection in php?

I’ve build a form but I’m kind of stuck at this thing where I have a yes or no field, and upon selecting yes some of the fields should appear otherwise those should be hidden if the user selects no. I’m not sure how to do it.

Here’s the code:

JavaScript

Advertisement

Answer

New here and also learning. Hope I’m following conventions ok. Here is an example of Gopi’s suggestion. I know you asked for PHP, but with just PHP you can’t change the page once it’s loaded.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement