Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 19th, 2007, 02:08 AM
Registered User
 
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to syedferhat
Default 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)







Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating a Date field based on another field arholly Access VBA 6 November 22nd, 2006 11:19 AM
Field problem (requires c# do loop) Indo77 ASP.NET 2.0 Basics 0 November 16th, 2006 12:02 PM
Copy previous field record if next field is null ecampos Access VBA 6 June 23rd, 2006 12:55 PM
Update city field based on zip field nganb SQL Server ASP 0 April 22nd, 2004 10:30 PM
nested while loop doesn't loop hosefo81 PHP Databases 5 November 12th, 2003 08:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.