开发者

How do I display/compare a dynamic value of a mysql row in a if statement?

I have a checkboxes on my site that when unchecked, update their row in in the db as unchecked, and if checked,update their row in the db as checked. I am creating an ifstatement that will commence with its command if checked, and not if unchecked. I have echoed the variable and it is holding the proper value (checked or unchecked) but not sure if I am syntactically correct on displaying the state of the row in the db.

This is what I am trying and will not work. I am new at php still and thank you very much for any help.

if($auth->check_prof == 'checked'){开发者_如何学运维// do the stuff in here}



<input type="checkbox" name="auth" value="checked" />


<?php
if(isset($_POST['auth'])) {
    $auth->check_prof = 'checked'; // or $_POST['auth']
}


It might be a problem of confusing $auth->check_prof and $auth['check_prof'].

Are you sure $auth is an object? If not, try if ($auth['check_prof'] == 'checked').

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜