943,965 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 18698
  • ASP RSS
Mar 10th, 2005
0

recordset from multiple checkbox values

Expand Post »
I have a page that displays the records from the database (repeated down) if the user selects (checkbox) a few records and clicks submit it passes the value (dbase record ID) to another page that retrieves the value and builds another recordset with just the records selected from the first page.

The webmail pages make use of this (ie: select a few e-mails and click "trash" and those e-mails get deleted)
Similar Threads
Reputation Points: 10
Solved Threads: 2
Junior Poster
william_stam is offline Offline
131 posts
since Mar 2005
Mar 21st, 2005
0

Re: recordset from multiple checkbox values

Give your checkboxes the same name.
<input type="checkbox" name="mycheckbox" value="1">
<input type="checkbox" name="mycheckbox" value="2">
.
.
.
n

Then when the form is posted you have an array which you can iterate or pass to a stored procedure or whatever your prefered method is.

ASP Syntax (Toggle Plain Text)
  1. sql="update table set column=value where id in ("
  2.  
  3. for i = 0 to Request.Form("mycheckbox").length - 1
  4. if i=0 then
  5. sql=sql & Request.Form("mycheckbox").item(i)
  6. else
  7. sql=sql & "," & Request.Form("mycheckbox").item(i)
  8. end if
  9. next
  10.  
  11. sql = sql & ")"
  12.  
  13. con.execute(sql)
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: check box
Next Thread in ASP Forum Timeline: repeat region into declared variable (jmail body)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC