Here I having one multidimensional array; in this array I am having two indexes:
- mandatoryCheckingReport
- specialCharectorReport
Now what I want to do means I have to take the values from that two index
and I have to display in html table, but I don't know how display array values in my html table. I am new to development, please update me with an answer.
print_r($viewWorkSheet);
Array
(
[mandatoryCheckingReport] => Array
(
[uniformID] => Array
(
[testCase] => uniformID empty checking
[devTeamResult] => success
[testingTeamResult] => test case success
)
[studentID] => Array
(
[testCase] => studentID empty checking
[resultCode] => C001
[devTeamResult] => success
[testingTeamResult] => test case success
)
)
[specialCharectorReport] => Array
(
[uniformID] => Array
(
[testCase] => uniformID specialCharector checking
[devTeamResult] => success
[testingTeamResult] => test case failure
)
[studentID] => Array
(
[testCase] => studentID specialCharector checking
[devTeamResult] => success
[testingTeamResult] => test case failure
)
)
)
My expected output is like this:
<!DOCTYPE html>
<html>
<head>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
</head>
<body>
<h2>HTML Table</h2>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Heading</th>
<th>Test Case</th>
<th>Input Field</th>
<th>DevTeam Result</th>
<th>TestingTeam Result</th>
<th>Expected Result</th>
</tr>
</thead>
<tbody>
<!-- mandatoryCheckingReport array values start here -->
<tr>
<td rowspan="5">mandatoryCheckingReport</td>
<td>uniformID empty checking</td>
<td>uniformID</td>
<td>success</td>
<td><small class="label label-success"> test case success</small></td>
<td>OK</td><!-- Static is Ok fine -->
</tr>
<tr>
<td>studentID empty checking</td>
<td>studentID</td>
<td>success</td>
<td><small class="label label-success"> test case success</small></td>
<td>OK</td><!-- Static is Ok fine -->
</tr>
<tr>
<td>startFrom empty checking</td>
<td>startFrom</td>
<td>success</td>
<td><small class="label label-success"> test case success</small></td>
<td>OK</td><!-- Static is Ok fine -->
</tr>
<tr>
<td>limit empty checking</td>
<td>limit</td>
<td>success</td>
<td><small class="label label-success"> test case success</small></td>
<td>OK</td><!-- Static is Ok fine -->
</tr>
<tr>
<td>profileID empty checking</td>
<td>profileID</td>
<td>success</td>
<td><small class="label label-success"> test case failure</small></td>
<td>OK</td><!-- Static is Ok fine -->
</tr>
<!-- specialCharectorReport array values start here -->
<tr>
<td rowspan="5">specialCharectorReport</td>
<td>uniformID specialCharector checking</td>
<td>uniformID</td>
<td>success</td>
<td><small class="label label-success"> test case failure</small></td>
<td>OK</td><!-- Static is Ok fine -->
</tr>
<tr>
<td>studentID specialCharector checking</td>
<td>studentID</td>
<td>success</td>
<td><small class="label label-success"> test case failure</small></td>
<td>OK</td><!-- Static is Ok fine -->
</tr>
<tr>
<td>startFrom specialCharector checking</td>
<td>startFrom</td>
<td>success</td>
<td><small class="label label-success"> test case success</small></td>
<td>OK</td><!-- Static is Ok fine -->
</tr>
<tr>
<td>limit specialCharector checking</td>
<td>limit</td>
<td>success</td>
<td><small class="label label-success"> test case success</small></td>
<td>OK</td><!-- Static is Ok fine -->
</tr>
<tr>
<td>profileID specialCharector checking</td>
<td>profileID</td>
<td>success</td>
<td><small class="label label-success"> test case failure</small></td>
<td>OK</td><!-- Static is Ok fine -->
</tr>
</tbody>
</table>
</body>
</html>