I am an electronic engineering student. I have a doubt concerning Web development. I have to make a web site for doctors to enter patients data. Most of the data are in check box format. My question is regarding saving and re fetching check box status from the data base, so that the user can see what all are checked previously and what all are not checked when he log's in back the next time. And also how can i replace the check-box status in database if i change the status. I searched about this in internet but there is no much data concerning this. So if anyone could guide me or give me a link or example codes where i can look and study, it will be a great help for me.
Asked
Active
Viewed 225 times
0
-
Maybe tell us what database you are using. I gather via your tags that your backend language is PHP. – bytesized Apr 28 '15 at 20:09
-
Can you post the code that you have tried so far and also post what exactly is not working ? – Maximus2012 Apr 28 '15 at 20:09
-
@Maximus2012 i made the check boxes and saved the data's in database . Now i want to know how to re fetch the status and how to replace it if i make a change the next time i logged in. – user3747901 Apr 28 '15 at 20:19
-
See if this helps: http://stackoverflow.com/questions/7851868/whats-the-proper-value-for-a-checked-attribute-of-an-html-checkbox – Maximus2012 Apr 28 '15 at 20:20
-
@bytesized i use phpmyadmin /wamp server – user3747901 Apr 28 '15 at 22:04
1 Answers
1
You can save the values of a particular check box in many different way and there are tons of resources online for this, I am sure you have come accross this information before.
You could save your check box values as a string with a string delimiter, for example: A-B-C-D-E
. This was you can split/explode the string whenever you need to retrieve the values again as an array and appropriately mark the corresponding check boxes once they sign in again.
Some Resources: http://www.html-form-guide.com/php-form/php-form-checkbox.html
send checkbox value in PHP form

Community
- 1
- 1
-
I saw the code but there is no much detail of how to re fetch the data from the DATABASE..As you recommended, In many pages i saw some mentioning of explode and implode but i couldn't understand it ,can you help? – user3747901 Apr 28 '15 at 20:35
-
Read the value from the database as a simple string. Then once you explode the string by the '-' delimiter you now have an array of all the values. Now with that array you can use Javascript or JQuery to match the corresponding input either by their value or id, depending on how you set up your check boxes. – Apr 28 '15 at 20:37