jeudi 9 mars 2017

want to pass checkbox from database to checked and update with codeigniter

I'm learning CodeIgniter. And then i have a question. How if I want checked checkbox on the form with the data from the database, and can be updated.

I have a code like this:

<input type="checkbox" name="game[]" value="Dota 2" <?php echo($crdid['game'] === 'Dota2') ? "checked='checked'" : ''; ?>>Dota 2
<input type="checkbox" name="game[]" value="Point Blank" <?php echo($crdid['game'] === 'Point Blank') ? "checked='checked'" : ''; ?>>Point Blank
<input type="checkbox" name="game[]" value="League of Legend" <?php echo($crdid['game'] === 'League of Legend') ? "checked='checked'" : ''; ?>>League of Legend
<input type="checkbox" name="game[]" value="Counter Strike" <?php echo($crdid['game'] === 'Counter Strike') ? "checked='checked'" : ''; ?>>Counter Strike

But that code cant checked at form. Please help me. Thank you




Aucun commentaire:

Enregistrer un commentaire