July 15th, 2003, 02:13 AM
How do i update a row in a database when a checkbox is checked?
July 15th, 2003, 08:40 AM
You can still do what you want, but a form would have to be submitted to do that. The code to update would look something like this
That would assume you had a checkbox named checkbox_name and it's value was yes.
// Do your connection stuff
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
if(request.getParameter("checkbox_name") == "yes")
String sql = "UPDATE tablename SET (val1 = 'val1', val2 = 'val2', val3 = 'val3'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
Last edited by StevenC; July 15th, 2003 at 08:46 AM.
July 15th, 2003, 10:15 AM
July 15th, 2003, 10:21 AM
Steven, not Stephen
July 15th, 2003, 10:29 AM
Iam sorry for that.Thanks Steven.
July 15th, 2003, 11:37 AM