SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast joeyramirez's Avatar
    Join Date
    Nov 2011
    Location
    Cabanatuan City, Philippines
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    fetch data from table and display as check boxes

    Can someone tell me how to retrieve data from table and display it as checkboxes.

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    What is the structure of the data?

    Checkboxes can only offer True/False, On/Off indications. As such for each checkbox you check the state of the database item, and if it is True then you add:

    checked="checked"

    to the HTML, else you add nothing.
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Enthusiast joeyramirez's Avatar
    Join Date
    Nov 2011
    Location
    Cabanatuan City, Philippines
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have a table that contains an ID and its corresponding name.I need it to be displayed in a checkbox .For example, I have ID=001,name=sample and ID=002,name=sample2 on the database.It will look like these;

    [] sample1
    [] sample2

  4. #4
    SitePoint Zealot gidday's Avatar
    Join Date
    Jan 2007
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi joeyramirez

    Do you mean

    <input type="checkbox" name="widget" value="<%= rs("id") %>" /> <%= rs("name") %>
    Joe
    "All that is necessary for the triumph of evil
    is that good men do nothing."

  5. #5
    SitePoint Enthusiast joeyramirez's Avatar
    Join Date
    Nov 2011
    Location
    Cabanatuan City, Philippines
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tnx gidday. I already got it.


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
  •