Dynamic form

Please help Nyubu. I searched for information, but did not really find anything.

The next question. I need to create a questionnaire (form). For example, I have the first field in which I must enter a value. As you enter, it checks whether the data entered is correct. For example, 6 options. If the correct option is entered, then for each of the 6 options it is proposed to select its own list of valid options as a pop-up list. Then you can do the same again, for example, for each of the options for the pop-up list there is another list. Implemented here http://www.nvidia.ru/Download/index.aspx?lang=ru

When all the fields are filled in, a hint pops up with instructions, and at the bottom send it to php for processing, where php writes the data to the database. (Processing and writing is not difficult, I know how it is implemented, help with substitution of options depending on the previous answer.)

I would be very grateful for your advice.


Answer 1, authority 100%

The direction of action.
Option one:
We create a tree of all possible options, like:

$tree = new Array();
$tree['firstStringFirstInput'] = new Array();
$tree['firstStringFirstInput']['firstStringSecondInput'] = new Array();
$tree['secondStringFirstInput'] = new Array();

etc. Then we get the values ​​from this array.

Second variant (like n-vidi):
After each input change, we make an ajax request, in which we pass the name of the input and its value. Depending on this, we create a SELECT query to the database with unloading values ​​for the next form input.


Answer 2

this is Ajax // better look for jQuery Ajax PHP validation