For Each Field loop
I have form with four set of option button and four Checkbox. I tried to get their name and value by using following code but the problem is that when i checked any of the check box it will display the value twice and also incorrect.
please find ASP codes and results below
ASP CODEs STARTS
For Each Field In Request.Form
if left(field,3)="Qst" then
MQID=mid(FIELD,4,10)
else
MQID=mid(FIELD,1,10)
end if
chbest="rashid"
MAnsID=Request.Form(Field)
StrSQl="Insert into User_Answer(QstID,AnsID,Best_Qst)
Values (" & MQID & "," & MAnsID & "," & ChBest & ")"
'To Display SQL STring
response.Write(StrSQL & "<br>")
Next
END OF CODES
Result
Insert into User_Answer(QstID,AnsID,Best_Qst) Values (1,2,rashid)
Insert into User_Answer(QstID,AnsID,Best_Qst) Values (Best_Qst,1,rashid) (This line was duplicate)
Insert into User_Answer(QstID,AnsID,Best_Qst) Values (3,2,rashid)
Insert into User_Answer(QstID,AnsID,Best_Qst) Values (2,2,rashid)
Insert into User_Answer(QstID,AnsID,Best_Qst) Values (4,2,rashid)
|