0
<?php counter = 0 ?>
@foreach($buildings as $building)
<?php
$var1 = counter;
$counter = counter + 1;
?>
<input type="checkbox"
id="campo{{counter}}"
name="campo{{counter}}><td>{{$name_building}}</td>
<br />
@endforeach
How do we fix this?
If you have two items inside foreach
, should look like this
<input type="checkbox" id=campo1 name=campo1...
<input type="checkbox" id=campo2 name=campo2...
How I assign a field within a foreach
within the HTML
?
I don’t quite understand, what you wish to do ???
– novic
Virgilio Novic: I need to name the input...put the id with the name that comes within the foreach...field type[1] field[2] field[3]... but this html does not allow, so how should I do? for each checkbox field should have a different name and how to do this?
– Emilio Dami Silva
Basically:
<input type="checkbox" value="{{$nome do campo}}">
!– novic
right, but I don’t need value, I need the field id, I’ll improve the question...
– Emilio Dami Silva
Basically:
<input type="checkbox" id="{{$nome do campo}}">
just put the field and value inside!– novic
id="field{counter}}" and counter being a counter inside the foreach and what I’m trying now...thanks for so far!
– Emilio Dami Silva
Solved! Thank you!
– Emilio Dami Silva