I have problem with simple if function. I can't get it to work although I tried everything, and I really don't know what is problem.
So get_option is WordPress function and it gets value correctly. If I echo $my_field_id I get correct values, either 0 or 1. This if should check if value is one and in that case it should print that checkbox is checked and if it is 0, it should print.PHP Code:<?php
$my_field_id = get_option('my_field_id');
$broj = 1;
function my_field_callback() { ?>
<input name="my_field_id" type="checkbox" value="1"
<?php
if ($my_field_id == $broj)
{
print('checked="checked"');
} ?>
/>
<?php } ?>
Problem is that no matter what value is, "checked" is always printed. What I'm doing wrong?
Thanks in advance



Reply With Quote

Bookmarks