PHP and JS - How to create a form with sub selects [duplicate]

0

My plan is to create a form where you have 2 selects . In # select # 1 will have names transferred through MySQL. By choosing the desired select 1 # name, it automatically displays data of the desired name.

Example

#1 select: joao, ruben
Selecionado: joao

#2 select:
Caso escolha o #1 joao: giro, feio, gordo etc
Caso escolha o #1 ruben: - gordinho, inteligente, lalalal

Is there a way to create it there?

    
asked by anonymous 06.04.2018 / 02:13

1 answer

-1

You can create two selects: the first for the person's name, the second for the characteristics. The second starts invisible (display: none (in css) or .hide () (in jquery's function))) When the first val () exists, the second appears (.show ()). The function that will give this .show (), will have an if to identify the value of the first select. Depending on which one, the second will get the correct characteristics added in the form: $ ("# firstInput"). Html ('blablabla')

    
06.04.2018 / 02:23