Checkboxes not update in asp database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Keith Boesker
    New Member
    • Dec 2010
    • 14

    Checkboxes not update in asp database

    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.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    It would help to see your code.

    Comment

    • Keith Boesker
      New Member
      • Dec 2010
      • 14

      #3
      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.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Append the different elements into one string. But I don't recommend doing this. It will work but your data will be denormalized and make future querying more difficult.

        Comment

        • Keith Boesker
          New Member
          • Dec 2010
          • 14

          #5
          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.

          Comment

          Working...