I have a page that first looks up a list of courses, as the results list is being built in HTML using classic ASP, I add a checkbox at the end of each <TR>. The checkbox name is built dynamically, i.e., each checkbox name is built as "checkbox1", checkbox2, etc. Each checkbox is assigned a value from two fields from each row of the objRS (resultset) so that the value is formed in the form of a value list of an sql insert clause.
The code that builds this RS is:
Code:
objRSschedule.Open strSQL, strConn, 3, 3
Response.Write "<table class=""auto-style5"" border=""0"" cellpadding=""1"" cellspacing=""0"" style=""vertical-align: bottom"">" &_
"<tr class=""auto-style7""><td colspan=""4""><b><u>List of Available Classes</u></b></TD></tr><P></P>" & _
"<P></P><tr class=""auto-style6""><td>Class Name |</TD><td> Class Date |</TD><td> Class Time |</TD><td> Enroll Me</TD></tr>"
Do Until objRSschedule.EOF = True
intChkBxVal = intChkBxVal + 1
Response.Write "<TR class=""auto-style5"">" & _
"<td>" & objRSschedule ("ClassName") & "</TD>" & _
"<td>" & objRSschedule ("ClassDate") & "</TD>" & _
"<td>" & objRSschedule ("ClassTime") & "</TD>" & _
"<td><input name=""Checkbox" & intChkBxVal & """type=""checkbox"" Value=""('" & strContactID & "','" & objRSschedule("ClassID")& "')""></TD>" & _
"</TD></TR>"
The resulting HTML list looks like this:
List of Available Classes
Class Name |Class Date |Class Time |Enroll Me
Spin 1/12/2015 7:00 PM [checkbox]
Spin 1/17/2015 6:00 AM [checkbox]
Spin 1/26/2015 5:00 AM [checkbox]
TRX 1/27/2015 7:00 AM [checkbox]
If you were to inspect the checkbox elements presented on the web page, the resulting HTML code looks like this:
<input name="Checkbox1" type="checkbox" value="('1','160')">
AND
<input name="Checkbox2" type="checkbox" value="('1','159')"> ,
etc., for each class returned.
I would like the user to be able to check multiple checkboxes AND based on the boxes checked, have the value in the Value clause be the value of the insert clause to be entered into another table, classSignup. Ex.
INSERT INTO ClassSignup
VALUES ('1','159'); <----- this value string is what needs to be inserted in the ClassSignup table
Is there any way to do this without forcing the user to do a separate insert operation for for each box checked?