The problem: In a page I have two select, one that selects the team and another the team members, the first (of the team) I fill the option
with php (by query in the database), so he will list all the teams I have registered in the database. I want you to change the team in this select
, so that it loads select
all members of this team (also recorded in the database).
I thought of doing with Jquery
and Ajax
, no change of select.equipe
he requests on a php page, which searches for members related to the id of the selected team. But I'm having trouble getting the php return, because it will be more than one member.
I tried to set up php with a string
in html with the options and then give a append
of that string in select.membros
, but with no results.
I also tried .html
instead of .append
. I searched in several places and only found how to put option
one by one, and does not solve my case because I have to put several at the same time, and the results of the query are mounted in options with values corresponding to the id of the member and content
with the member's name.
How do I add multiple options in select.membros
and delete them in .change
of select.equipe
? Or if you have a better method of doing this (change the options of select.members according to the change of select.equipment) how do I?
Sorry for the bad formatting, it's urgent and I'm on my cell phone.