Hello experts,
I need a hand. On my asp submit page I have the following code: -
-
for i = 1 to 5 ' 5 question form'
-
-
Question = Request.Form("Q" & i)
-
Answer = Request.Form("A" & i)
-
Comment = Request.Form("C" & i )
-
-
ValComment = Replace(Comment, "'", "''")
-
ValAnswer = Replace(Answer, "'", "''")
-
-
checkbox = Request.Form("check")
-
checkbox = Split(checkbox,", ")
-
-----------------------------------------------------------------------------------------
-
Set oConn = Server.CreateObject("ADODB.Connection")
-
oConn.Open "removed for security reasons"
-
set sSQL = server.CreateObject ("ADODB.Recordset")
-
set sSQL1 = server.CreateObject ("ADODB.Recordset")
-
--------------------------------------------------------------------------------------------
-
IF........somthing here in the checkbox = STRUGGLING HERE please help
-
sSQL = "INSERT into Table (ID, Question, Answer, Comments, TimeStamp,
-
UserID)"
-
sSQL = sSQL & "VALUES (Test_seq.nextval, '" & Question &"', '" &
-
checkbox &"', '" & ValComment &"', sysdate, '"& User & "')"
-
-
Else
-
sSQL1 = "INSERT into table (ID, Question, Answer, Comments, TimeStamp,
-
UserID)"
-
sSQL1 = sSQL1 & "VALUES (Test_seq.nextval, '" & Question &"', '" &
-
ValAnswer &"', '" & ValComment &"', sysdate, '"& User & "')"
-
response.write ssql1 & "<BR>"
-
End IF
-
Next
-
response.end
-
Note: just the bulk of the code has been added so that you get an idea
of what it is that I am talking about.
On my html form I have a combination of dropdownlists and combo
boxes. The checkboxes all have the same name. It is basically 1
question checkbox with the ability to choose 5 answers. I have a
total of 5 questions(1 checkbox question and 3 drop downs and 1
textbox. What I am struggling with is how do I get the answers from
the checkboxes into the database as well as the other form elements.
If it is much easier to not parse the comma separated list then so be
it:) Thanks everyone. 1 2615
"MrHelpMe" <cl********@hotmail.comwrote in message
news:11**********************@n59g2000hsh.googlegr oups.com...
Hello experts,
I need a hand. On my asp submit page I have the following code: -
for i = 1 to 5 ' 5 question form'
-
Question = Request.Form("Q" & i)
-
Answer = Request.Form("A" & i)
-
Comment = Request.Form("C" & i )
-
ValComment = Replace(Comment, "'", "''")
-
ValAnswer = Replace(Answer, "'", "''")
-
checkbox = Request.Form("check")
-
checkbox = Split(checkbox,", ")
-
-----------------------------------------------------------------------------------------
-
Set oConn = Server.CreateObject("ADODB.Connection")
-
oConn.Open "removed for security reasons"
-
set sSQL = server.CreateObject ("ADODB.Recordset")
-
set sSQL1 = server.CreateObject ("ADODB.Recordset")
-
--------------------------------------------------------------------------------------------
-
IF........somthing here in the checkbox = STRUGGLING HERE please help
-
-
if checkbox(0) = correct answer then
-
-
-
-
sSQL = "INSERT into Table (ID, Question, Answer, Comments, TimeStamp,
-
UserID)"
-
sSQL = sSQL & "VALUES (Test_seq.nextval, '" & Question &"', '" &
-
checkbox &"', '" & ValComment &"', sysdate, '"& User & "')"
-
-
-
you have set sSQL to be a recordset. now you are treating it as a string.
-
-
-
a recordset is for reading from a database, not for writting to it.
-
-
you need somthing like this
-
-
sql = "your sql statement"
-
-
cn.open "your connection string"
-
cn.execute(sql)
-
cn.close
-
-
-
-
-
-
-
>
-
Else
-
sSQL1 = "INSERT into table (ID, Question, Answer, Comments, TimeStamp,
-
UserID)"
-
sSQL1 = sSQL1 & "VALUES (Test_seq.nextval, '" & Question &"', '" &
-
ValAnswer &"', '" & ValComment &"', sysdate, '"& User & "')"
-
response.write ssql1 & "<BR>"
-
End IF
-
Next
-
response.end
-
-
-
>
Note: just the bulk of the code has been added so that you get an idea
of what it is that I am talking about.
On my html form I have a combination of dropdownlists and combo
boxes. The checkboxes all have the same name. It is basically 1
question checkbox with the ability to choose 5 answers. I have a
total of 5 questions(1 checkbox question and 3 drop downs and 1
textbox. What I am struggling with is how do I get the answers from
the checkboxes into the database as well as the other form elements.
If it is much easier to not parse the comma separated list then so be
it:) Thanks everyone. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Pete |
last post by:
Okay, I'm still stuck with this problem. Here's a quick recap/summary :-
1. Page 1:User checks 3 out of 10 checkboxes and submits form to page 2
2. Page 2:Item count shows 3 items. User checks...
|
by: Frank Collins |
last post by:
Can anyone point me to some good examples on the web of
using values from dynamically created checkboxes on forms
in ASP, particularly relating to INSERTING those values
into a SQL or Access...
|
by: Renie83 |
last post by:
What I have are two pages. One is a form with some input boxes and
check boxes on it. It is posting to a different script page that
inserts into a database and sends the fields through email. My...
|
by: DylanM |
last post by:
I have some checkboxes that are generated from the results of a database search. At the moment, the checkboxes are part of a table making up a form. Users are going through the form, clicking the...
|
by: claudel |
last post by:
Hi
I have a newb PHP/Javascript question regarding checkbox processing
I'm not sure which area it falls into so I crossposted to comp.lang.php
and comp.lang.javascript.
I'm trying to...
|
by: zoneal |
last post by:
Hello there,
Currently I am working with the project which needs dynamically
generated checkboxes and i have
generated dynamic checkboxes but i am facing problem with getting the
value of...
|
by: TechnoAtif |
last post by:
Hi to all.
I have got a form containing of checkboxes along with other items.
I have simply no clue as to
(i) how to make entry for those checkbox data into the mysql table . I mean : what query...
|
by: markrawlingson |
last post by:
It seems that a lot of people run into this issue in regards to dealing with the result that checkboxes return to the Request.Form object. So this article is intended to fully explain how checkboxes...
|
by: beacon |
last post by:
Hi everybody,
I have a quality assurance database that has a form with a bunch of checkboxes on it that serve as reasons for why a product didn't pass inspection.
It's a given that the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |