I have a form with html table in my view. How do I get all data from the html table to my controller by request. The following code is my view.
<table id="masterpayrollhead-table" class="table table-bordred table-striped">
<thead>
<th style="">Id</th>
<th>Payhead</th>
<th>Payhead Type</th>
<th>Computation</th>
<th>Calculation</th>
<th style="text-align: right;">Rate</th>
<th style="text-align: right;">Value</th>
</thead>
<tbody>
@foreach($masterPayroll as $row)
{!! Form::open(array('method'=>'POST', 'route' => array('payroll.update',$approveMasterPayroll[0]->EmpId, $approveMasterPayroll[0]->FYId), 'class' => 'form-horizontal', 'id' => 'payroll-form')) !!}
{{ csrf_field() }}
<tr>
<td style="width: 80px; height: 5px">{!! Form::text('PHId',$row->PHId, ['class'=>'form-control', 'readonly', 'style'=>'text-align:right;']) !!}</td>
<td>{{ $row->PayHead }}</td>
<td>{{ $row->PayHeadType }}</td>
<td>{{ $row->Computation }}</td>
<td>{{ $row->Calculation }}</td>
<td style="width: 100px; height: 5px">{!! Form::text('Rate',$row->Rate, ['class'=>'form-control', 'readonly', 'style'=>'text-align:right;']) !!}</td>
@if($row->CalcId == 2)
<td style="width: 150px; height: 5px">{!! Form::text('Value',$row->Value, ['class'=>'form-control', 'style'=>'text-align:right;']) !!}</td>
@else
<td style="width: 150px; height: 5px">{!! Form::text('Value',$row->Value, ['class'=>'form-control', 'readonly', 'style'=>'text-align:right;']) !!}</td>
@endif
</tr>
{!! Form::close() !!}
@endforeach
</tbody>
</table>
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community