populating a select from an sql table created by a prior select

I have 2 selects in my form

The first one creates a table with the selections the client makes.

This table is cleared at the beginning.

The second select is based on 2 tables, a main table and the table crated in the first selection.

When I open the site all selections are clear, when I finish the first selection the second one is still clear, I need to populate without reloading the page since it resets all the tables. (mainly the first with the selected values)

Is there a way to have it populated when I hover or click on the 2nd select?
robrodpAsked:
Who is Participating?
 
James RodgersWeb Applications DeveloperCommented:
you need to use an ajax call to create the options list and then use this to populate the second select

use jQuery for the ajax call, it will save you some time and effort
http://api.jquery.com/jquery.ajax/

use a call back function to populate the select with the new options
at it's most basic it will be something like this
$j.ajax({
			type: "GET",
			url: "random-post.php?lang=" + $j.ifen('en','fr'),
			dataType: "html",
			success: function(msg){
						//do something;		                
				}
		});	

Open in new window


some caveats

some versions of IE do not like having the option list updated so you will need to replace the entire select
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
The first one creates a table with the selections the client makes.
Can you be more specific? It sounds as if this part is working except it's not populating the second select. Is that correct? If so, are you using ajax to create this table or are you submitting and reloading the page when the first selection is made?
0
 
robrodpAuthor Commented:
Thx.. the IE comment makes it a no no.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.