Gayner Posted July 29, 2009 Share Posted July 29, 2009 I have this: <input type="checkbox" name="VIEW_IMG" value="1"> But if They uncheck it, then save profile it will make the value="0". Possible? Thank you, I dont want to use javascript formoBJ.value= bla bla. I need to know how to do this with PHP Hope you can help me.. Thank u! Quote Link to comment https://forums.phpfreaks.com/topic/167933-solved-quick-help-on-php-checkboxes/ Share on other sites More sharing options...
mmarif4u Posted July 29, 2009 Share Posted July 29, 2009 if($_POST['VIEW_IMG'] != '') { $value = $_POST['VIEW_IMG']; } else { $value = 0; } Quote Link to comment https://forums.phpfreaks.com/topic/167933-solved-quick-help-on-php-checkboxes/#findComment-885719 Share on other sites More sharing options...
RichardRotterdam Posted July 29, 2009 Share Posted July 29, 2009 I have this: <input type="checkbox" name="VIEW_IMG" value="1"> But if They uncheck it, then save profile it will make the value="0". Uhm what Quote Link to comment https://forums.phpfreaks.com/topic/167933-solved-quick-help-on-php-checkboxes/#findComment-885720 Share on other sites More sharing options...
Gayner Posted July 29, 2009 Author Share Posted July 29, 2009 Hi Thank you for your response. For some reason that makes my field say "NULL" In the database Any ideas sir? Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/167933-solved-quick-help-on-php-checkboxes/#findComment-885722 Share on other sites More sharing options...
mmarif4u Posted July 29, 2009 Share Posted July 29, 2009 In both cases it insert NULL, or just if they uncheck it. What is the data type for field? Quote Link to comment https://forums.phpfreaks.com/topic/167933-solved-quick-help-on-php-checkboxes/#findComment-885727 Share on other sites More sharing options...
Gayner Posted July 29, 2009 Author Share Posted July 29, 2009 In both cases it insert NULL, or just if they uncheck it. What is the data type for field? view_img tinyint(1) Null is Yes and Default it set to 1. And yes if they uncheck it : Quote Link to comment https://forums.phpfreaks.com/topic/167933-solved-quick-help-on-php-checkboxes/#findComment-885728 Share on other sites More sharing options...
Gayner Posted July 29, 2009 Author Share Posted July 29, 2009 Seemed like when I changed null to no instead of Default yes it worked, thank u sir ! Topic Resolved! <3 Quote Link to comment https://forums.phpfreaks.com/topic/167933-solved-quick-help-on-php-checkboxes/#findComment-885737 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.