Mr Chris Posted September 14, 2007 Share Posted September 14, 2007 Hi Guys, I have a database column which either holds the value 1 or 0. Now if there is a 1 in this column I want to produce a checkbox button that is ticked, and if a 0 then nothing ticked. So I thought it would work like this: <input name="dayTwo[]" type="text" id="dayTwo" value="<?php echo $databaseArray['d2']?>" size="6" /> However, it does not seem to work? Any suggestions? Thanks Chris Quote Link to comment https://forums.phpfreaks.com/topic/69320-checkbox-help-please/ Share on other sites More sharing options...
phat_hip_prog Posted September 14, 2007 Share Posted September 14, 2007 Here's one of my wrappers: function helpers_form_checkbox_s($name, $checked) { if ($checked == 0) { $checked = ""; } else { $checked = "checked"; } return "<input type=\"checkbox\" name=\"".$name."\" ".$checked.">"; } Quote Link to comment https://forums.phpfreaks.com/topic/69320-checkbox-help-please/#findComment-348321 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.