473,396 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

checkboxes and databases

hi there

I want to collect user input. I have a collection of 30 checkboxes that I
would like the user to pickout from. The information then will be recorded
to a database somehow. Finally the user will be allowed to change the
selection if required.

Which is the best way to do this. Do I need to create 30 different fields in
the database ?

Thanks
Feb 28 '06 #1
2 1201

raj chahal wrote:
hi there

I want to collect user input. I have a collection of 30 checkboxes that I
would like the user to pickout from. The information then will be recorded
to a database somehow. Finally the user will be allowed to change the
selection if required.

Which is the best way to do this. Do I need to create 30 different fields in
the database ?

Thanks


3 tables - one to hold user information, one to hold checkbox
information and one to join the two. So, if your checkboxes related to
colours, for example, the checkbox information table would be called
Colours. It would have an ColourID field and a ColourName field. To
write the checkboxes to the browser, you would select the records:

<%
sql="SELECT ColourID, ColourName FROM Colours"
set rs = conn.execute(sql)
if not rs.eof then
arrColours = rs.getrows
rs.close : set rs = nothing
for i = 0 to ubound(arrColours,2)
response.write "<input type='checkbox' name='colourid' value='"
& arrColours(0,i) & "'>"
response.write arrColours(1,i) & "<br>" & vbcrlf
next
else
response.write "no records"
rs.close : set rs = nothing
end if
%>

Once a user has made their selection, and you have caught their userid
in the form somewhere ( or querystring), on submission,
Request.Form("colourid") will hold a comma-delimited string of values.
This is where the 3rd table - UserColours comes into play. It has 2
fields - UserID and ColourID.

To process the comma-delimited string, do something like this:

<%
colours = Request.Form("ColourID")
colours = split(colours,",")
for i = 0 to ubound(colours)
conn.execute("Insert INTO UserColours (UserID, ColourID) VALUES ("
& userid & "," & colours(i) & ")")
next
%>

/P.

Feb 28 '06 #2

"raj chahal" <in**@digitise.info> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I want to collect user input. I have a collection of 30 checkboxes that I
would like the user to pickout from. The information then will be recorded
to a database somehow. Finally the user will be allowed to change the
selection if required.

Which is the best way to do this. Do I need to create 30 different fields in the database ?


That depends on what the check boxes are. It would most likely be one field
for each "group" of checkboxes.

--
Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com
-----------------------------------------------------
Understanding the ISA 2004 Access Rule Processing
http://www.isaserver.org/articles/IS...cessRules.html

Troubleshooting Client Authentication on Access Rules in ISA Server 2004
http://download.microsoft.com/downlo...7/ts_rules.doc

Microsoft Internet Security & Acceleration Server: Guidance
http://www.microsoft.com/isaserver/t...dance/2004.asp
http://www.microsoft.com/isaserver/t...dance/2000.asp

Microsoft Internet Security & Acceleration Server: Partners
http://www.microsoft.com/isaserver/partners/default.asp

Deployment Guidelines for ISA Server 2004 Enterprise Edition
http://www.microsoft.com/technet/pro...isaserver.mspx
-----------------------------------------------------

Feb 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pete | last post by:
There is a Summary/Example further down... On page one of my site I have a form with some checkboxes and detailed descriptions. When the form is submitted (to page two), the values of the...
6
by: terence.parker | last post by:
I currently have the following JS in my header: function checkall(thestate) { var checkboxes=eval("document.forms.EssayList.file_id") for (i=0;i<checkboxes.length;i++)...
4
by: jez123456 | last post by:
Hi, I have a string array as follows string databases = {"C:\Master.mdb", "C:\Toolbox.mdb", "C:\Import.mdb", "C:\Library.mde", "C:\User.mdb", "C:\ImpData.mdb"}; I need some code that will...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
5
by: masterej | last post by:
Developers, Is there any way to disable all checkboxes on a form? I have a form with 160 checkboxes and I want to be able to disable all of them. Is there a way I can do something like this: ...
3
by: aaa2876 | last post by:
Hello everyone! I am in the process of setting up a client contact database for my office and I have run into a bit of a snag. The database I have allows for one address per client but some of...
6
by: dream2rule | last post by:
Hello All, I am trying to validate multiple checkboxes whose values are stored in an array using php. I have been trying from a really long time but nothing's working out. Can anyone help? ...
8
by: PeteOlcott | last post by:
http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_change_structure.html I would like to completely understand how GUI controls such as this one are constructed. In the...
7
by: viki1967 | last post by:
I need one function javascript that: 1) when I enter in this htm page I see enabled only checkbox of categories A, M and T; checkboxes of microcategories all disabled; 2-a) If I select the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.