dynamically query handling
hi
we are developing page that contain checkbox and textbox which are dynamically generated.when we click on check box textbox will be enable.we enter value in textbox.now we want to insert that values in database on click event of button. rest of values should not enter in database, but we are not manupulate dynamic button and check box.
Source Code:
<%@page session="false" %>
<%@page import="java.util.*"%>
<%@page import="java.sql.*"%>
<html>
<head> </head>
<body>
<%
Statement st=null;
Connection con=null;
ResultSet rs=null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("Jdbc:Odbc:unisoft ");
st = con.createStatement();
rs = st.executeQuery("SELECT * from course");
%>
<form name="form" method="post" action="">
<table border="1" align="center" width=650 height=0 cellpadding=8>
<tr>
<td colspan=3> <font size=4> Fees Structure <hr> </font> </td>
</tr>
<tr>
<td width=92> Course Name </td>
<td width="7"> : </td>
<td width="200"> <select name="course">
<option value="abc">ABC</option>
<% while(rs.next())
{
%>
<option value="<%= rs.getString(1)%>"> <%= rs.getString(2) %></option>
<% } %>
</select> </td>
<%
}
finally
{
if(st!=null) st.close();
//if(rs!=null) rs.close();
if(con!=null) con.close();
}
%>
</tr>
</table>
<table border="1" align="center" width=650 height=0 cellpadding=8>
<tr>
<td width=92> Course Name </td>
<td width="7"> : </td>
<td width="200"> <select name="course">
<option value="Day"> Day </option>
</select>
<td> </td>
</tr>
<tr align="center">
<td> <input type="button" name="next" value="Next" style="width:100"> </td>
<td> <input type="button" name="next" value="Reset" style="width:100"> </td>
<td> <input type="button" name="next" value="Cancel" style="width:100"> </td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
help us to solve that problem.
thanks
megha