I have a question about how to get value from input text within foreach()
, when I execute the code it gets the last row of data inside table.
Here is the view code:
<?php
$count = 1;
foreach ($data as $row) {?>
<thead>
<th>No</th>
<th>Out ID</th>
<th>Name</th>
<th>Dorm</th>
<th>Date</th>
<th>Approve</th>
<th>Comment</th>
<th>Action</th>
</thead>
<tbody>
<tr>
<td><center><?php echo $count; ?> </td>
<td><center><?php echo $row->IdOut; ?> </td>
<td><center><?php echo $row->Name; ?> </td>
<td><center><?php echo $row->Dorm; ?> </td>
<td><center><?php echo $row->Date; ?> </td>
<td><center><input type="checkbox" name="approvechk"></td>
<td><center><input type="text" name="aproverComment"></td>
<td><center><input type="submit" name="submit" value"submit"></td>
</tr>
</tbody>
<?php $count ++;
}
?>
How can I get the checked row and input from the table when submit is clicked?