lundi 17 juillet 2017

checked and disabled checkbox based on mysql condition in php

I have a page with users listing in admin section. I have the approved users with disabled checkboxes and unapproved users with enabled checkboxes. Now I want to show approved users as "checked" and disable checkboxes. I searched a lot but couldn't get clue. PLease a help or suggestyion will be appreciated.

Here is my code for that,

<input type="checkbox" name="all_check[]" <?php echo $disabled ;?> value="<?php echo $row['id']; ?>" class="checkbox" id="status" ></td>

And the condition to show disabled as,

if ($status == '1') { 

    $disabled = "disabled";
}

Aucun commentaire:

Enregistrer un commentaire