Jump to content


Checkbox php small problem

  • Please log in to reply
1 reply to this topic

#1 blade_922

  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 14 September 2006 - 07:56 PM

				<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.


#2 HuggieBear

  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 14 September 2006 - 08:18 PM

Can you actually show me the php?

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

Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users