Hi People,
I've got a small query regarding checkboxes.
I have a form, where there are input box, textarea, radio buttons and checkboxes.
After form submit, Insert query gets fired and data gets inserted properly. I'm storing checkbox value as a string, I mean, the checkbox array... I'm converting it as string using the "implode" function and then storing it in the database table.
Now the problem is, I wan't to edit those details, so I've created the same form... and I'm fetching those stored records and populating them inside the textboxes. I've got no issues with textbox and textarea. Issue is checkbox data. I can fetch that stored string, use explode function...and later on display as checkboxes... but how to display those checkbox options which the user never checked when he had initially filled the form...?
Its like, say in my form...
Name: Albert //--------------- textbox
Age: 27 // --------------- textbox
Contact: 123456 // --------------- textbox
Hobbies: // ---------------checkboxes
Swimming
Trekking
Scuba Diving
Birding
...............
Now say i selected only Swimming and Trekking... those values will be posted.. and in the database the string will be like..... Swimming,Trekking
Now to display this back as checkboxes in the editable form...using explode I need to make the string back to checkboxes...(I want to show this as checked by default)... How to display the other options which i never checked .... in this case Scuba Diving and
Birding... I mean I wanna display them in the form (and also as unchecked)....
Thanks.