I need the checkbox to be checked ONLY if $c
(POST) is 1 or if $d['is']
is 1.
Here is my code:
if ( ($d['is'] == 1) OR $c == 1)
$data = 'checked="checked"';
Th开发者_如何学JAVAe problem is, if checkbox is checked, and I uncheck this and hit the submit button it is still checked because $d['is']
is still 1. So at the end: it should check the box only if $c
(POST) is 1 or if $d['is']
is 1 but if $c == 0
(POST) (unchecked checkbox) checkbox shouldnt be checked.
It's hard to desribe my problem, so if you don't understand anything, please just post a comment.
So what you're saying is you want it checked if $c==1
or $d['is'] == 1
, but not if $c==0
? If this is the case, why does $d['is']
come into it at all? Just have it checked if $c==1
and you're done...
精彩评论