mercredi 15 février 2017

fetch data from imploded value and checked the checkbox

i am still confuse with array things. I am stuck and can't solve my problem. Here are my problem. First of all this is my checkbox code.

  <?php
  <div class="checkbox">
    <label>';
    ?>
    <input type="checkbox" name="latarbelakang[]" id="cekbox_latarbelakang1" <?php if(in_array("Pencapaian Kompetensi Karyawan",$tuj)) { ?> checked="checked" <?php } ?> value="Pencapaian Kompetensi Karyawan">
    Pencapaian Kompetensi Karyawan
    <?php
        echo '</label>
      </div>

    <div class="checkbox form-inline">
      <label>
      <input type="checkbox" id="cekbox_latarbelakang2" value="Mengacu pada Analisa GAP pada FPT Nomor">
       Mengacu Pada Analisa GAP pada FPT Nomor
     </label>
    <input type="text" id="textbox_latarbelakang1" name="latarbelakang[]" class="form-control input-sm" placeholder="">
    </div>
      <div class="checkbox form-inline">
        <label>
         <input type="checkbox" id="cekbox_latarbelakang3" value="">
               Lain - lain
        </label>
        <input type="text" id="textbox_latarbelakang2" name="latarbelakang[]" class="form-control input-sm" placeholder="Lain - lain">
    </div>

and this is my checkbox looks like http://ift.tt/2llGZKB. So here is my problem. First i am save my checkbox value and textbox with implode(), and there is no problem with save record. My problem is how to fetch data from database and explode it and checked the checkbox if there is database's value match with checkbox's value, i have give a checking process in checkbox with id "cekbox_latarbelakang1" and it works perfectly. And if there is a texbox inside checkbox, i just save textbox value not checkbox value, and if i fetch data from database, i don't know how to put data into the right textbox. Hope someone can tell me how to solve it, or give me an advice. Thank you and hv a nice day!!




Aucun commentaire:

Enregistrer un commentaire