I wanted to chain 3 selects and I got it working using this code. http://jsfiddle.net/FJFFJ/1/
The issue I now have is, how do I fetch the selected values from each dropdown in PHP? For example, the above creates 3 select boxes when the page is opened. When I click on "+" button and add more rows of selects, how do I fetch the values from all selects which were added dynamically and save those to mysql database in php?
anandatheerthan
0
Newbie Poster
Recommended Answers
Jump to PostSelect names should not have the [] appended to them (you use this approach for grupped elements like radio button or checkbox groups). So:
<select class="semester" name="semester">
The third select element does not have a name attribute at all, so add it.
And this is how …
Jump to PostThere are two problems:
- The new select elements do not get inserted within exiting form tags but outside. Probably the div with the id=filter should be inside the form.
- the newly inserted select elements all have the same name which is semester. You have to make up a logic in …
Jump to PostI took some time to have a closer look at the jquery code as well. I changed it a bit to make it clear and working. See the comments in the code and consider the following:
- I made the template containing the filter (the three select elements within a div) …
All 12 Replies
broj1
356
Humble servant
Featured Poster
anandatheerthan
0
Newbie Poster
broj1
356
Humble servant
Featured Poster
anandatheerthan
0
Newbie Poster
broj1
356
Humble servant
Featured Poster
anandatheerthan
0
Newbie Poster
broj1
356
Humble servant
Featured Poster
anandatheerthan
0
Newbie Poster
broj1
356
Humble servant
Featured Poster
Mukta_2
commented:
Thanks a lot for this code! It helped me. Is it possible to calculate the sum of values selected in the third dropdown list of all rows added by user?
+0
anandatheerthan
0
Newbie Poster
phpcake
0
Newbie Poster
Mukta_2
commented:
I think it's better for you to create another thread of this questions @phpcake
+0
phpcake
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.