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 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.">"; } Link to comment https://forums.phpfreaks.com/topic/69320-checkbox-help-please/#findComment-348321 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.