Jump to content

Checkbox php small problem


blade_922

Recommended Posts

[code]

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


[/code]

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.

Regards
Link to comment
https://forums.phpfreaks.com/topic/20772-checkbox-php-small-problem/
Share on other sites

Archived

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

×
×
  • Create New...

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.