I have a list of checkboxes like 1,2,3,4,5 when I use update statement I get 1 instead of 1,2,3,4,5 in my database column. I have checked to make sure request.form is returning 1,2,3,4,5 and it is but it only update one value instead of the array of numbers. Is there a simple way to get this to update correctly? Thanks for your help in advance.
This is an array and it is a very useful way to get checkboxes info from your users an put it one database column.
Update statement
Code:
NMGroups = Request.Form("NMGroups")
strSQL = "UPDATE NewsletterMembers set NMGroups = '" & NMGroups & "' WHERE NMID =" & NMID
checkboxes are all name NMGroups with value of 1,2,3,4 etc
I just need the array of numbers to update to one table called NMGroups in my database. Right now it works in my insert statement but when I us the update statement it only grabs the first number in the array. How do I grad all numbers like 1,2,3,4 and save it.
I will say it one more time: That is *TERRIBLE TERRIBLE* database design.
Even if you only read the first few paragraphs of any book or article on DATABASE NORMALIZATION you will learn that. And any GOOD book or article on database design *WILL* include a section on normalization, guaranteed.
But if you are going to do this despite what any database designer will tell you, then at least show us the *CODE* that you say is not working.
What does the design of your table NMGroups look like, for starters? What does the SQL query that you are using to do UPDATE NMGroups ... look like?
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
NMGroups is a number field in the database. the update script listed below updates but only puts 1 number instead of the array of numbers like 1,2,3,4 my insert statement on a different page works fine. Just when the use goes to update this list it only put 1 number when 1,2,3,4 are checked.
fixed it I forgot to remove the whitespace used replace(request.form("NMGroups"), " ", "") 1, 2, 3, 4 almost looks like1,2,3,4 when I did the response.write to verify the form.