Checkbox

Permalink
I have a function called CheckBoxToInt.
function CheckBoxToInt($value)
      {
         if($value == "on")
            $value = 1;
         else
            $value = 0;
         return $value;
      }


And this is how I use it in the controller.php of my block.

$db->query($query, array($pageID, CheckBoxToInt($action)));


$action is a checkbox.

When I check to $action checkbox I still get the value "on" instead of 1.

Some one got any clue?

Sorry for the pore spelling :)

 
codingpenguins replied on at Permalink Reply
Did you ever get an answer for this?
SVijay replied on at Permalink Reply
SVijay
Hi,

Try this

function CheckBoxToInt($value)
      {
         if($value == "on"){
            $v = 1;
          }else{
            $v = 0;
          }
         return $v;
      }
codingpenguins replied on at Permalink Reply
I was thinking the same thing. I was also thinking that it could have been an issue with the way the textbox was defined. You can just have the texbox return 1 or 0 instead of "on". Just removing that method all together if it isnt needed. I was just trying to be helpful and thanks for the input openjuicevijay : )