开发者

Checkbox actions

开发者 https://www.devze.com 2023-04-10 15:42 出处:网络
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)

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...

0

精彩评论

暂无评论...
验证码 换一张
取 消