Greetings!
I am trying to create a dynamic list of radio buttons from a table in my database. I want the table to have however many rows necessary, but be three table cells across. I think I have something close to working, just that it is not really working. I am getting the same record three times in the same row before it moves on to the next record in the table. What I need is to have one record per table data cell. When the row reaches three cells, it starts another row, continuing on with the next record in the table. Here is my code...can anyone take a peek and let me know where my logic is a little off-base?
Any help would be greatly appreciated!
Thanks!
G
I am trying to create a dynamic list of radio buttons from a table in my database. I want the table to have however many rows necessary, but be three table cells across. I think I have something close to working, just that it is not really working. I am getting the same record three times in the same row before it moves on to the next record in the table. What I need is to have one record per table data cell. When the row reaches three cells, it starts another row, continuing on with the next record in the table. Here is my code...can anyone take a peek and let me know where my logic is a little off-base?
Code:
Response.Write "<tr><td align=""left"" colspan=""5""><b>Check the one category that best describes your current area of employment:</b></td></tr>"
'-------------------------------------------------------------
'dynamic dropdown for Position list starts here
'create recordset object
Dim a,b
Dim catCount
Dim sqlMembershipEmploymentCatAdd
Dim objRSMembershipEmploymentCatAdd
Set objRSMembershipEmploymentCatAdd = Server.CreateObject("ADODB.Recordset")
'create SQL statement to get all fields for all records in the state table of the database
'and order the records by ID number
sqlMembershipEmploymentCatAdd = "SELECT * FROM membership_employment_category ORDER BY category;"
'open the recordset
objRSMembershipEmploymentCatAdd.Open sqlMembershipEmploymentCatAdd, objConn, 2, 3
objRSMembershipEmploymentCatAdd.MoveFirst
Response.Write "<tr><td colspan=""4"">"
Response.Write "<table border=""1"">"
'catCount = objRSMembershipEmploymentCatAdd.RecordCount
Do While Not objRSMembershipEmploymentCatAdd.EOF
Response.Write "<tr>"
a=0
b=3
For a=1 to b
Response.Write "<td align=""left"" valign=""top"">"
Response.Write "<input type=""radio"" name=""ID_employment_cat"" value=" & Chr(34) & objRSMembershipEmploymentCatAdd("ID_employment_cat") & Chr(34) & "></td><td width=""200"">" & objRSMembershipEmploymentCatAdd("category") & VbCrLf
Response.Write "</td>"
b=b+1
Next
Response.Write "</tr>"
objRSMembershipEmploymentCatAdd.MoveNext
Loop
Response.Write "</table>"
Response.Write "</td></tr>"
'-------------------------------------------------------------
Any help would be greatly appreciated!
Thanks!
G