SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Arizona
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Dynamic Checkboxes

    Let me see if I can explain. I have a table with primary key and one other field. This table contains 10 records. I created an .asp page that dynamicly lists the records on the page with a checkbox next to each record.

    First question: How do I pass the selected choices to another page?

    Second question: How do I store those choices in another table (such as a user preference table)?

    Any thoughts would be helpful. Thanks.

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2004
    Location
    nowhere
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Create a users table with a field for each checkbox name. Then make sure your checkboxes have different names.

    <input type="checkbox" name="checkbox1" />
    <input type="checkbox" name="checkbox2" />

    Code:
    <%
    If Request.QueryString("checkbox1") = "on" Then
    	'insert on value for this field
    Else
    	'insert off value for this field
    End If
    
    If Request.QueryString("checkbox2") = "on" Then
    	'insert on value for this field
    Else
    	'insert off value for this field
    End If
    %>
    You could probably also do it with a loop and create the checkbox variable dynamically based on what request variables were returned to the page. I can't tell you the exact code. Been a while since I did ASP.
    Shopping Deals and Target Coupons

  3. #3
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Arizona
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Thanks I'll give that a try.


    Quote Originally Posted by CouponMonkey
    Create a users table with a field for each checkbox name. Then make sure your checkboxes have different names.

    <input type="checkbox" name="checkbox1" />
    <input type="checkbox" name="checkbox2" />

    Code:
    <%
    If Request.QueryString("checkbox1") = "on" Then
    	'insert on value for this field
    Else
    	'insert off value for this field
    End If
     
    If Request.QueryString("checkbox2") = "on" Then
    	'insert on value for this field
    Else
    	'insert off value for this field
    End If
    %>
    You could probably also do it with a loop and create the checkbox variable dynamically based on what request variables were returned to the page. I can't tell you the exact code. Been a while since I did ASP.


Bookmarks

Posting Permissions

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