Jump to content


This topic is now archived and is closed to further replies.


Checkbox php small problem

Recommended Posts


<input type="checkbox" name="mainhot" value="" <?php echo $row->mainhot ? 'checked="checked"' : ''; ?> />


K so thats the code above. What im doing is creating a check box. So if the checkbox is checked then value in database will change to '1' if its then unchecked it will change to '0'

Ok so with this code i manage to change the value in the database to 1 for the first time. Then when i try to uncheck it and click save on my page it ends up staying checked and the value doesnt go back to 0.

I dont have a clue why its doing this. Hope you can assist.


Share this post

Link to post
Share on other sites
Can you actually show me the php?

I need to see what's going in and coming out of the database.


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.