In the code below I am trying to use a group of checkboxes to insert information into two different tables. I have two questions here.
1. The first FOR statement works but it inserts the info in the database in one record seperated by a comma such as..
deaID RegionName
________________________________
449 | Houston,Hometown

I need it to put each value in a new record like so..
deaID RegionName
________________________________
449 | Houston
449 | Hometown

2. The second For statement doesn't work at all and I think it is because the information has already been used in the first FOR statement so it "no longer exists"???.
Is this right?....if so how do I fix it?
<%
deaID=request("deaID")
For each chk in request("regionname")
if chk <> "" then
sql3 = "INSERT into DealerRegions (deaID,RegionName) Values ('"&deaID&"','"&request("regionname")&"')"
end if
set addregion = conn.execute(sql3)
NEXT
For each chk in request("regionname")
if chk <> "" then
sql = "SELECT RegionCodes.zipcode FROM RegionCodes WHERE RegionName='" & request("regionname") & "'" '& "Order by RegionCodes.zipcode"
end if
'sql = "SELECT RegionCodes.zipcode FROM RegionCodes WHERE RegionName='" & region & "'" & "Order by RegionCodes.zipcode"
set getregioncodes = conn.execute(sql)
Do while not getregioncodes.eof
sql2 = "INSERT INTO NewDealercodes (deaID, dealercode) Values ('"&deaID&"',"&getregioncodes("zipcode")&")"
response.write "SQL2 is " & sql2 & ""
set addzipcodes = conn.execute(sql2)
getregioncodes.MoveNext
loop
next
%>