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')
.
精彩评论