
Hi,
I need code for inserting the multiple select box values into database.Please do send me the code.
Thanks for ur immediate replies its helping a lot.

1)selectmultiple.jsp:
<html>
<form method="post" action="insertmultiple.jsp">
<pre>
Select Languages <select name="sel" multiple>
<option value="English">English</option>
<option value="Hindi">Hindi</option>
<option value="French">French</option>
<option value="German">German</option>
<option value="Chinese">Chinese</option>
</select>
<input type="submit" value="submit">
</pre>
</form>
</html>
2)insertmultiple.jsp:
<%@page import="java.sql.*"%>
<%
String languages="";
String lang[]=request.getParameterValues("sel");
for(int i=0;i<lang.length;i++){
languages+=lang[i]+" ";
}
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
Statement st=con.createStatement();
int i=st.executeUpdate("insert into student(languages) values('"+languages+"')");
out.println("Data is successfully inserted into database.");
}
catch(Exception e){
System.out.println(e);
}
%>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.