dimanche 5 août 2018

Save many values in one checkbox laravel

i have table that show all files from public/folder,

with format name 1_CCA-2018-0182224-720422085426

  1. 1_CCA-2018-0182224 this is ACCOUNT ID

  2. 720422085426 this is ID NO

when user check the checkbox i want to save filename to 2 column (ACCOUNT ID & ID NO)
I Use hidden to get ID NO value, but the problem is, the value of ID NO is not match with filename,

if i thick the last record, ID NO will save ID NO before the last record,

but if thick the first record, ID NO save correctly,

can anyone help me?

<table id="dataTable" class="table table-bordered table-condensed table-hover table-striped" width="100%" border="1">
  <thead>
  <tr>
    <th width="5%">No</th>
    <th width="45%">Account ID & ID No</th>
    <th data-checkbox="true" width="5%"></th>
  </tr>
</thead>
<tbody>
<?php $i=1; 
 ?>
<tr>
<td>1 </td>
<td>123</td>
<td><input type="checkbox"  name="account_id[]" value="" >
<input type="hidden"  name="file[]" value="">               
<input type="hidden"  name="id[]" value="">
 </td>
                                        
                                        </tr>
                                        <tr>
<td>2 </td>
<td>1234</td>
<td><input type="checkbox"  name="account_id[]" value="" >
<input type="hidden"  name="file[]" value="">               
<input type="hidden"  name="id[]" value="">
 </td>
                                        
                                        </tr>
                                <?php  $i++; ?>
                        </tbody>  
                    </table>



Aucun commentaire:

Enregistrer un commentaire