I"m phuxored (complete ASP n00b) - Multiple checkboxes on a form?

I"m phuxored (complete ASP n00b) - Multiple checkboxes on a form?

am 19.01.2007 19:32:48 von manningfan

I apologize for being a total n00b here, I'm pretty good with Access so
I understand some of the theory but I know little to nothing about ASP.

I want to create a form. On the form will be a question, something
like, "Which cars are your favorites?"

I want to put several checkboxes on the form and allow as many
selections as they want to check off.

I also want to put a text box where the user can leave comments, and
another where the put their name.

What's the best way to set up a table(s) so that I can store individual
responses to the form? How do I write the code if I'm going to do this
in ASP with an Access back end? Any help would be appreciated.

Re: I"m phuxored (complete ASP n00b) - Multiple checkboxes on a form?

am 19.01.2007 22:45:17 von Mike Brind

"ManningFan" wrote in message
news:1169231568.206216.255150@a75g2000cwd.googlegroups.com.. .
>I apologize for being a total n00b here, I'm pretty good with Access so
> I understand some of the theory but I know little to nothing about ASP.
>
> I want to create a form. On the form will be a question, something
> like, "Which cars are your favorites?"
>
> I want to put several checkboxes on the form and allow as many
> selections as they want to check off.
>
> I also want to put a text box where the user can leave comments, and
> another where the put their name.
>
> What's the best way to set up a table(s) so that I can store individual
> responses to the form? How do I write the code if I'm going to do this
> in ASP with an Access back end? Any help would be appreciated.
>

First, you will need to know enough about ASP and ADO so that you can
connect to a database and perform an insert operation. You will also need
to understand how an html form passes values either using POST or GET.
Finally, you will need to know how to retrieve the values from the posted
form.

www.w3schools.com/asp and www.w3schools.com/ado will get you started.
Another very good tutorial series can be found here:
http://msconline.maconstate.edu/tutorials/ASP/default.htm


--
Mike Brind

Re: I"m phuxored (complete ASP n00b) - Multiple checkboxes on a form?

am 22.01.2007 16:53:15 von manningfan

Well, I've done simple stuff connecting to DBs and spitting info out.
I just need to kno whow to store the value of a bunch of checkboxes and
keep it so that if more checkboxes are added in the future I can do it
through a table or something instead of having to edit the code.

Mike Brind wrote:
> "ManningFan" wrote in message
> news:1169231568.206216.255150@a75g2000cwd.googlegroups.com.. .
> >I apologize for being a total n00b here, I'm pretty good with Access so
> > I understand some of the theory but I know little to nothing about ASP.
> >
> > I want to create a form. On the form will be a question, something
> > like, "Which cars are your favorites?"
> >
> > I want to put several checkboxes on the form and allow as many
> > selections as they want to check off.
> >
> > I also want to put a text box where the user can leave comments, and
> > another where the put their name.
> >
> > What's the best way to set up a table(s) so that I can store individual
> > responses to the form? How do I write the code if I'm going to do this
> > in ASP with an Access back end? Any help would be appreciated.
> >
>
> First, you will need to know enough about ASP and ADO so that you can
> connect to a database and perform an insert operation. You will also need
> to understand how an html form passes values either using POST or GET.
> Finally, you will need to know how to retrieve the values from the posted
> form.
>
> www.w3schools.com/asp and www.w3schools.com/ado will get you started.
> Another very good tutorial series can be found here:
> http://msconline.maconstate.edu/tutorials/ASP/default.htm
>
>
> --
> Mike Brind

Re: I"m phuxored (complete ASP n00b) - Multiple checkboxes on a form?

am 22.01.2007 17:38:33 von Mike Brind

"ManningFan" wrote in message
news:1169481195.114854.248970@v45g2000cwv.googlegroups.com.. .
> Mike Brind wrote:
>> "ManningFan" wrote in message
>> news:1169231568.206216.255150@a75g2000cwd.googlegroups.com.. .
>> >I apologize for being a total n00b here, I'm pretty good with Access so
>> > I understand some of the theory but I know little to nothing about ASP.
>> >
>> > I want to create a form. On the form will be a question, something
>> > like, "Which cars are your favorites?"
>> >
>> > I want to put several checkboxes on the form and allow as many
>> > selections as they want to check off.
>> >
>> > I also want to put a text box where the user can leave comments, and
>> > another where the put their name.
>> >
>> > What's the best way to set up a table(s) so that I can store individual
>> > responses to the form? How do I write the code if I'm going to do this
>> > in ASP with an Access back end? Any help would be appreciated.
>> >
>>
>> First, you will need to know enough about ASP and ADO so that you can
>> connect to a database and perform an insert operation. You will also
>> need
>> to understand how an html form passes values either using POST or GET.
>> Finally, you will need to know how to retrieve the values from the posted
>> form.
>>
>> www.w3schools.com/asp and www.w3schools.com/ado will get you started.
>> Another very good tutorial series can be found here:
>> http://msconline.maconstate.edu/tutorials/ASP/default.htm
>>
> Well, I've done simple stuff connecting to DBs and spitting info out.
> I just need to kno whow to store the value of a bunch of checkboxes and
> keep it so that if more checkboxes are added in the future I can do it
> through a table or something instead of having to edit the code.
>

I'm not sure I understand what you mean by "how to store the value of a
bunch of checkboxes". Do you mean how to insert a bunch of values in a
database? If so, you use an Insert statement.

In terms of how you structure your table, that depends on what kind of
information you want to get out of it at the end.

--
Mike Brind

Re: I"m phuxored (complete ASP n00b) - Multiple checkboxes on a form?

am 22.01.2007 18:03:16 von manningfan

Can you give me an example of the proper insert statement if I had 3
checkboxes on a form, chk1, chk2 and chk3?

Mike Brind wrote:
> I'm not sure I understand what you mean by "how to store the value of a
> bunch of checkboxes". Do you mean how to insert a bunch of values in a
> database? If so, you use an Insert statement.
>
> In terms of how you structure your table, that depends on what kind of
> information you want to get out of it at the end.
>
> --
> Mike Brind

Re: I"m phuxored (complete ASP n00b) - Multiple checkboxes on a form?

am 22.01.2007 18:22:16 von Mike Brind

OK. The SQL will depend on how you structure your table. I guess at the
moment, you don't know the answer to that.

Let's say you have a question "Which of the following colours do you like?"
And you have a set of checkboxes representing the colour choices:
Red

Red

Red

Red

Red



"ManningFan" wrote in message
news:1169485396.398161.134350@51g2000cwl.googlegroups.com...
> Can you give me an example of the proper insert statement if I had 3
> checkboxes on a form, chk1, chk2 and chk3?
>
> Mike Brind wrote:
>> I'm not sure I understand what you mean by "how to store the value of a
>> bunch of checkboxes". Do you mean how to insert a bunch of values in a
>> database? If so, you use an Insert statement.
>>
>> In terms of how you structure your table, that depends on what kind of
>> information you want to get out of it at the end.
>>
>> --
>> Mike Brind
>

Re: I"m phuxored (complete ASP n00b) - Multiple checkboxes on a form?

am 22.01.2007 18:35:24 von Mike Brind

Sorry about that - copying and pasting sent my post somehow....
Where was I? Oh yes...

OK. The SQL will depend on how you structure your table. I guess at the
moment, you don't know the answer to that.

Let's say you have a question "Q1. Which of the following colours do you
like?"
And you have a set of checkboxes representing the colour choices:

Red

Blue

Green

Brown

Orange


Because we gave the same name to each of the checkboxes, this grouped them,
and any values will be sent as a comma-separated string, so when someone
ticks Red and Green, what gets passed in the Request collection is a
name/value pair is:
name = Q1
value = Red,Green

If you are happy to store "Red,Green" in the field for Q1, then the Insert
statement is straightforward:

Insert into Questions (Q1) Values ('" & Request.Form("Q1") & "')

However, if the person answering the questions missed Q1, then
Request.Form("Q1") will not exist. Checkbox values are only passed if they
are selected. You can test the length of the value to see if there is
anything there:

If Len(Request.Form("Q1")) = 0 'then you know it wasn't answered.

You need to think a bit more about what information you want to store then
have a go at doing it. If and when you run into problems or get error
messages, come back with the code you tried and a description of the
problem.

--
Mike Brind


"ManningFan" wrote in message
news:1169485396.398161.134350@51g2000cwl.googlegroups.com...
> Can you give me an example of the proper insert statement if I had 3
> checkboxes on a form, chk1, chk2 and chk3?
>
> Mike Brind wrote:
>> I'm not sure I understand what you mean by "how to store the value of a
>> bunch of checkboxes". Do you mean how to insert a bunch of values in a
>> database? If so, you use an Insert statement.
>>
>> In terms of how you structure your table, that depends on what kind of
>> information you want to get out of it at the end.
>>
>> --
>> Mike Brind
>