I have two array, one is meant for table heading and second is meant for table data.
Table Heading array
Array
(
[0] => techrepublic.com
[1] => office.microsoft.com
[2] => en.pstrecovery.net
[3] => easeus.com
[4] => download.cnet.com
[5] => datanumen.com
[6] => 2324
)
Table Data array
Array
(
[software services] => Array
(
[datanumen.com] => 2
[office.microsoft.com] => 3
[easeus.com] => 8
[download.cnet.com] => 9
[en.pstrecovery.net] => 10
)
[software services in Delhi] => Array
(
[en.pstrecovery.net] => 1
[datanumen.com] => 3
[office.microsoft.com] => 4
[easeus.com] => 9
[download.cnet.com] => 10
)
[orignal software services] => Array
(
[en.pstrecovery.net] => 1
[easeus.com] => 6
[download.cnet.com] => 7
[datanumen.com] => 8
[office.microsoft.com] => 9
)
)
I want output table as shown in attachment
What i have done till now
// code for table heading
foreach ( $_POST['competitor']) as $value) { // $_POST['competitor'])
// containts table heading
// array
echo "<th>". $value ."</th>" ;
}
//code for table row
foreach ($details as $Keywords => $comp) { // $details contains row
// data array
echo '<tr><td>' .$Keywords . '</td>';
foreach ($_POST['competitor'] as $competitor) {
if (isset($comp[$competitor])) {
echo '<td>' . $comp[$competitor] . '</td>' ;
} else {
echo '<td>Not Found</td>' ;
}
}
echo '</tr>' ;
}
I am unable to arrange td and tr. How can I achieve the output as shown in attachment?
