Trying to Insert checkbox values into a database u

Results 1 to 2 of 2

Thread: Trying to Insert checkbox values into a database u

  1. #1
    Join Date
    Dec 1969

    Default Trying to Insert checkbox values into a database u

    Hi,<BR><BR> I have a asp page in which there are say three checkboxes.<BR><BR> when I check one of the checkboxes the other two checkboxes will be disabled using javascript and the same function applies when I check the other two checkboxes.<BR><BR>In my database I have fields for all the checkboxes and other text fields.<BR><BR>In another asp page when I try to insert the values of these three checkboxes <BR><BR>I get an "SYNTAX ERROR IN INSERT INTO STATEMENT". I am not using any reserved keywords.<BR><BR>But I believe that when I disable checkboxes in my previous page this problem occurs.<BR><BR>Please let me know if there is any way I can insert these checkbox values in the database<BR><BR>Thanks,<BR><BR>Prasanna<BR>

  2. #2
    Join Date
    Dec 1969

    Default If you only want 1 of the 3...

    ...why are you using checkboxes? Why not radio buttons?<BR><BR>Are you aware that the value of an UNCHECKED checkbox is blank. Null. Nothing there. ???<BR><BR>That is, if you do:<BR> &#060;%<BR> cb1 = Request("checkBox1")<BR> %&#062;<BR>and "checkBox1" wasn&#039;t checked on the prior page, then cb1 will be empty. So *of course* you can&#039;t then insert *that* value into the DB.<BR><BR>You should be doing something as simple as this:<BR> &#060;%<BR> If Request("checkBox1") &#060;&#062; "" Then<BR> cb1 = True &#039; or "Yes" or whatever you need for the DB<BR> Else<BR> cb1 = False<BR> End If<BR> %&#062;<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts