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 2618
"MrHelpMe" <cl********@hot mail.comwrote in message
news:11******** **************@ n59g2000hsh.goo glegroups.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 an additional 2
checkboxes and presses Update button. Item count now shows 5 checkboxes
are checked and "New" checkboxes remain checked.
3. Page...
|
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 database?
Basically, I have a form on which I have a series of
statements, with 3 checkboxes for each statement - YES,
NO, MAYBE. This series of...
|
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 problem
is sending the information which is checked through to the next page.
Each of my checkboxes is given the value of what should be inserted in...
|
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 boxes and saving to the database at the end with the 'Submit' command button.
Is it possible to save the changes as the checkboxes are clicked? I...
|
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 construct a checkbox array in a survey form where one
of the choices is "No Preference" which is checked by default.
If the victim chooses other than "No...
| |
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 selected checkboxes.
Problem is described below to understand easily, so please let me know
if you come to know the
|
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 to put for creating field corresponding to checkboxes. Create table arc(status ---?)
status is the array for checkboxes. what should be the data type...
|
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 are interpretted, what their values are and aren't, and how they should be handled if inserted into your database as a yes/no or bit field.
Most...
|
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 users will be able to select individual checkboxes to indicate the reasons. What I would like to find out how to do is to put a checkbox or radio...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |