tjg73 Posted December 12, 2007 Share Posted December 12, 2007 Perhaps this is an HTML question but since my question relates to MySQL I am thinking it is more PHP. I really need help figuring out how change the status of a checkbox from not checked to checked based on its value in the database. In the database the checkbox column says "YES" (that it has been checked) When the page is visited at a later date, I need to pull that value from the database and have that checkbox now CHECKED. Did this make sense? Can anyone help? thanks Quote Link to comment Share on other sites More sharing options...
sureshp Posted December 12, 2007 Share Posted December 12, 2007 Try this: ======== $checked = ($database_value == "YES") ? "checked" : ""; Use this $checked variable in the checkbox html tag as like below: <input type='checkbox' name='something' value='somethingsomething' $checked> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.