Click to See Complete Forum and Search --> : Please help : Unsure how to save to database dynamic Textfield values


lvsaint
10-17-2006, 11:37 PM
I'm trying to create a list to record student grades into the database. I'm able to pull out the names from the database and create a table with textfields in it to input the data into.

This is the code i'm using

for(int i = 0; rst2.next(); i++){
.......
<th scope="col"><input name="ca1_<%=i%>" type="text" id="exam1" size="7" /></th>
...

I'm using jsp and mysql

My database fields are exam1, exam2, exam3, exam4

Thank you so much for your help.

lvsaint
10-18-2006, 01:57 AM
This is what i've tried.

for(int i = 0; rst2.next(); i++){
String ca1 = request.getParameter("ca1_<%=i%>");
String query2 = "INSERT into results(ca1) values ('"+ca1+"')";
stm2.executeUpdate(query2);
}


The error as follows..

String not terminated at end of line.
String ca1 = request.getParameter("ca1_<%=i