Im trying to display each set of Array(first dimension) on a table. There will be a lot of array and table to be created in each page load, that's why I thought of using foreach. The array returned is from the controller.
My returned array looks like this:
Array: $appreq
Array
(
[0] => Array
(
[0] => Array
(
[Name] => Lot Survey Plans and Specifications
[Document] => -
[Id] => 10
[Is_Received] => 0
[Is_Personal_Submission] => 1
)
[1] => Array
(
[Name] => Others (Specify)
[Document] => -
[Id] => 11
[Is_Received] => 0
[Is_Personal_Submission] => 1
)
)
[1] => Array
(
[0] => Array
(
[Name] => Fire Protection Plan (if applicable)
[Document] =>
[Id] => 12
[Is_Received] => 0
[Is_Personal_Submission] => 1
)
)
[2] => Array
(
[0] => Array
(
[Name] => Vicinity Map or Location Plan within a Two(2) Kilometer Radius
[Document] => -
[Id] => 13
[Is_Received] => 0
[Is_Personal_Submission] => 1
)
[1] => Array
(
[Name] => Site Development Plan
[Document] => assets/uploads/ca060d9b-93d2-4fcd-8a8b-113bfac8dbbf/Architectural Permit/Site Development Plan...hollow-knight.jpg
[Id] => 14
[Is_Received] => 0
[Is_Personal_Submission] => 1
)
[2] => Array
(
[Name] => Perspective
[Document] => -
[Id] => 15
[Is_Received] => 0
[Is_Personal_Submission] => 1
)
Array: $ancillarypermit
The table should be displaying the data as divided in the first D array, then the rows is the next dimension of the array and my td should contain the: Name and Is_Received value. Please dont mind the table titles(Local Clearance etc), its part of another foreach loop, Im having trouble just with the tbody.
From the array: $appreq
the first dimensional: [0] => Array is the Local Clearance table
2 => Array is the Fire Safety table
3 => Array is the Architectural Permit table
EXPECTED TABLE:
There must be something wrong with how I used my foreach variables, and how I call the array to show in the . I really hope someone can help me through this, thanks in advance
UPDATE --------------
I tried doing the following as suggested:
<?php foreach($ancillarypermit as $row => $data) :
foreach($appreq as $row => $value) : ?>
<table style="text-align: left; width: 50%">
<thead>
<tr>
<th scope="col">#</th>
<th width='10' style="text-align:center;">Received</th>
<th scope="col">Requirement</th>
</tr>
</thead>
<tbody>
<h5><strong><?= $data->permit->Name ?></strong></h5>
<?php
foreach ($value as $key => $values) :
?>
<tr>
<th scope="row">1</th>
<td width='150' style='text-align: center; vertical-align: middle; padding: 3px'>
<?php
echo CheckboxX::widget([
'name'=>'s_1',
'value'=>$values['Is_Received'],
// 'readonly'=>true,
'pluginOptions'=>['threeState'=>false]
]);
?>
</td>
<td> <?= $values['Name'] ?> </td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endforeach;
endforeach;?>


