I need to create a form with a series of checkboxes, one for each entry in a table in a mySQL database.
I'm wondering if anyone can give me some idea of the best way to convert a returned list of values into a list of checkboxes which will add more checkboxes automatically if needed.
Also, once the values have been updated by the checkboxes, what is the best way to write them back?
Any help or ideas of where to start would be great. Thanks.
Need help with checkbox form
Moderator: General Moderators
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
I have a page with a list of quesitons that each have a radio button for yes,no, or n/a. I keep track of it by having a no_string and a na_string which each of which is simply a list of numbers, if question seven was answered na, then the na_string gets a 7. so then I check to see if each nymber is in either string. if its not, then its assumed yes. Does that help?
Thanks for the feedback, but I'm still not sure I understand fully.
Starting with first things first ... writing the boxes to the form. The number of checkboxes will depend on how many records there are that match the users ID, so the number will be different for everyone.
With this in mind, how should I go about naming the checkboxes? I had thought like 'item[1] item[2]' etc. But that doesnt appear to work at all.
How should I name them, and how can I keep track of the corellation of checkboxes to database options?
Thanks
Starting with first things first ... writing the boxes to the form. The number of checkboxes will depend on how many records there are that match the users ID, so the number will be different for everyone.
With this in mind, how should I go about naming the checkboxes? I had thought like 'item[1] item[2]' etc. But that doesnt appear to work at all.
How should I name them, and how can I keep track of the corellation of checkboxes to database options?
Thanks
-
joespenceley
- Forum Newbie
- Posts: 3
- Joined: Tue Mar 23, 2004 9:34 pm