I have the following code. I want to get only selected checkbox values but I get only last checkbox value. see what's wrong in my code.
<div class="box-body table-responsive no-padding">
<h4>Select Jobwork</h4>
<table id="data-table" class="table table-hover jobworks-table table-responsive">
<thead>
<tr style="background-color: #DDDD; color:firebrick;">
<th><input type='checkbox' value="1" name="select_all" /></th>
<th>JobWork Name</th>
<th>Description</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<?php foreach ($item as $key=>$value){
$decoded = json_decode($value['jobWorkJsonString']); ?>
<?php foreach($decoded as $row){ ?>
<tr class="odd gradeX">
<td><input type='checkbox' name="<?php echo $row->jobwork; ?>" /></td>
<td style="padding-left:0px;"><?php echo $row->jobwork; ?><input type="hidden" name="jobwork_name" value="<?php echo $row->jobwork; ?>"></td>
<td style="padding-left:0px;"><?php echo $row->description; ?><input type="hidden" name="jobwork_description" value="<?php echo $row->description; ?>"></td>
<td style="padding-left:0px;"><?php echo $row->jobPrice; ?><input type="hidden" name="price" value="<?php echo $row->jobPrice; ?>"></td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
<br>
</div>
Aucun commentaire:
Enregistrer un commentaire