Hi, i want to know how to extract values from drop down box for processing in next field. In my file first drop down has list of countries taken from a database. I want to show location of that particular country in the other dropdown. The list of all locations is also in the same database. My code is as follows.

<html><body><form name="frm" method="post" action="update.jsp">

<select name="coun" style="width: 246px" onChange ="this.frm2.submit();"  ><option value="">Select</option>
			 sql = dbconn.prepareStatement("select * from T500L order by LTEXT ");
					results = sql.executeQuery();
					String name = results.getString(2);
					String id   = results.getString(1);
		%><option value="<%= name %>">
		<% out.println(name); %>
		<%} results.close(); sql.close(); %>
                <select name="loc" style="width: 246px"><option value="">Select</option></select>


could anyone please give me a solution.

10 Years
Discussion Span
Last Post by manfosys

i have a suggestion create an arraylist,.. upon retrieving the values for the first dropown, store your needed values in the arraylistso that when you close the connection you can use arraylist in any possible ways that you want. Hope this helps.




Better u wil use onchange/onclick.In first dropdown box ,u wil use onclick javascript function when u select country.After u select a country ,the onclick javascript function wil cal.In that function u wil write code for retrieving corresponding location from db by pass the country id through the query string.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.