Using checkboxes

Results 1 to 2 of 2

Thread: Using checkboxes

  1. #1
    Join Date
    Dec 1969

    Default Using checkboxes

    Hi,<BR>I want to delete a item from a group of 3 items.There are check boxes next to each of the item. When the submit button is clicked, I look for any of the check boxes whether they are checked.If yes I delete that item from the database. But each time I click onto submit button, I get an error at: if (check =on)...I am pasting a part of my code, it will be great if someone could help me out.<BR><BR>check=Trim( Request.Form("checkbox1") )<BR> <BR>for i=1 to count<BR> if (check=on) then<BR> sql1 = "DELETE FROM Jcp where Name=&#039;"&strtemp&"&#039; and Product=&#039;"&product(count)&"&#039; and Quantity=&#039;"&quantity(count)&"&#039; "<BR> Set Recordset1 = Connection3.Execute(sql1)<BR> end if<BR>Next<BR><BR>Am I checking for the right condition?<BR>Thanx in advance,<BR>John

  2. #2
    LeeAnnie Guest

    Default RE: Using checkboxes

    Can the user select more than one option, or can they select only one option? If they need to select only one option, I would suggest using radio buttons and then give each input object the same name. Otherwise I would continue to use checkboxes:<BR><BR><BR>&#060;!-- Here is your form --&#062;<BR>&#060;form action="nextpage.asp" method="post" name="myForm"&#062;<BR>&#060;input type="checkbox" name="check1" value="true"&#062;One<BR>&#060;input type="checkbox" name="check2" value="true"&#062;Two<BR>&#060;input type="checkbox" name="check3" value="true"&#062;Three<BR>&#060;/form&#062;<BR><BR><BR>&#060;%&#039;Here is your processing page<BR><BR>for i = 1 to 3<BR>if cBool(request("check"&i)) then <BR> sql1 = "DELETE FROM Jcp" & _<BR> " WHERE Name = &#039;"&strtemp&"&#039;"& _<BR> " AND Product = &#039;"&product(i)&"&#039;"& _<BR> " AND Quantity = &#039;"&quantity(i)&"&#039;;" <BR> Set RS = Connection3.Execute(sql1,,adCmdText) <BR>end if <BR>next <BR>%&#062;<BR><BR><BR>The only issue that you may have is how you are populating your product and quantity array. Are those form values too? <BR><BR>Also, you will need to use adCmdText. You can get that file on this site. Do a search for and you should find the file and probably a description of how to use it (disregard that last sentence if you already knew about that file).<BR><BR>HTH

Posting Permissions

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