jeudi 21 juillet 2016

display if checkbox is checked while editing

As i had gone through several solutions i didnt get an solution for this. when i go for editing and open the page i want to show the list of check boxes as marked that i chooses while inserting. Here is my view page..

<div class="form-group">
        <label class="control-label col-sm-1" for="courses">Courses Completed</label>
         <div class=" col-sm-5">

         <input type="checkbox"  name="select_course[]" id="select_course" value="10" <?php if($row->courses =='10') echo "checked" ;?>>10
         <input type="checkbox"  name="select_course[]" id="select_course" value="12" <?php if($row->courses =='12') echo "checked" ;?>>12
         <input type="checkbox"  name="select_course[]" id="select_course" value="degree" <?php if($row->courses=='degree') echo "checked" ;?>>degree

         </div>
    </div>

by doing like this none of the checkbox is showing as checked state.the value inserted is like an array and my table looks like this

id  name        address             sex     courses     places                 image            password
 1  nesru         v                 male    "10"        tamilnadu   upld-file1469095130.jpg       l
 3  siraj   koonathil house        male     "10,12"     tamilnadu   upld-file1469167954.jpg       d




Aucun commentaire:

Enregistrer un commentaire