0
Good morning, I’m trying to make a form in a loop for each row of the table, when the user clicks the button on a row, picks up the data from that row and loads on another page, but for some reason in the loop the inputs don’t stay inside the form, follows the code of the loop:
if($total_row > 0)
{
foreach($data as $row)
{
$output .= '
<tr>
<form action="monitor/info" method="POST">
{{ csrf_field() }}
<td> <input type="text" readonly="" style="width: 310px" name="nome" id="nome" value="'.$row->nome.'" /></td>
<td> <input type="text" readonly="" style="width: 80px" name="usuariox" id="usuariox" value="'.$row->usuario_x.'" /></td>
<td> <input type="text" readonly="" style="width: 100px" name="aspect" id="aspect" value="'.$row->aspect.'" /></td>
<td> <input type="text" readonly="" name="supervisor" id="supervisor" value="'.$row->supervisor.'" /></td>
<td> <input type="text" readonly="" style="width: 70px" name="setor" id="setor" value="'.$row->setor.'" /></td>
<td> <input type="submit" class="btn btn-primary" value="Criar Laudo"></td>
</form>
</tr>
';
}
}
else
{
$output = '
<tr>
<td align="center" colspan="5">Nehum registro encontrado!</td>
</tr>
';
}
Follow in the browser as you interpret:
Can someone tell me where I’m going wrong?
I didn’t understand your loop... how you make a loop without a for, while etc...?
– Alvaro Alves
starts like this: if($total_row > 0) { foreach($date as $Row) { $output .= ' ' and ends like this: '; } } Else { $output = ' <tr> <td align="center" colspan="5">Nehum record found! </td> </tr> '; }
– Michel Diniz
Edit your question and add to the code so it’s easier to view
– Alvaro Alves
Question was edited
– Michel Diniz
I tried with GET too but the form is still there with nothing inside =(
– Michel Diniz
a moment, I am formulating an answer :D
– Alvaro Alves
by the way, which version of the Laravel you are using?
– Alvaro Alves
Version of Laravel 5.7
– Michel Diniz