So I'm using a foreach
to output my table-cells
and have run into a problem with my output.
This is what i'm trying to achieve:
<tr>
<th scope="col"> <h3>Ember</h3>
<p> Xeon E3-1231</p>
</th>
<th scope="col"> <h3>Ember</h3>
<p> Xeon E3-1231</p>
</th>
<th scope="col"> <h3>Ember</h3>
<p> Xeon E3-1231</p>
</th>
<th scope="col"> <h3>Ember</h3>
<p> Xeon E3-1231</p>
</th>
<th scope="col"> <h3>Ember</h3>
<p> Xeon E3-1231</p>
</th>
</tr>
This is my code:
<tr>
<?php
$tableheading = rwmb_meta( 'tb_table1_heading', 'type=text' );
foreach ( $tableheading as $heading )
{ ?>
<th scope="col"> <h3><?php echo $heading; ?></h3>
<p>
<?php
$tablesub = rwmb_meta( 'tb_table1_sub_heading' );
if (!empty($tablesub)){
$tablesubheading = rwmb_meta( 'tb_table1_sub_heading', 'type=text' );
foreach ( $tablesubheading as $subheading )
{ echo $subheading; }
} ?>
</p>
</th>
<?php } ?>
</tr>
Which is giving me this:
<tr>
<th scope="col">
<h3>Ember</h3>
<p>
Xeon E3-1231v3Xeon E3-1231v3 2Xeon E3-1231v3 3Xeon E3-1231v3 4Xeon E3-1231v3 5Xeon E3-1231v3 6</p>
</th>
<th scope="col">
<h3>Ember2</h3>
<p>
Xeon E3-1231v3Xeon E3-1231v3 2Xeon E3-1231v3 3Xeon E3-1231v3 4Xeon E3-1231v3 5Xeon E3-1231v3 6</p>
</th>
<th scope="col">
<h3>Ember3</h3>
<p>
Xeon E3-1231v3Xeon E3-1231v3 2Xeon E3-1231v3 3Xeon E3-1231v3 4Xeon E3-1231v3 5Xeon E3-1231v3 6</p>
</th>
<th scope="col">
<h3>Ember4</h3>
<p>
Xeon E3-1231v3Xeon E3-1231v3 2Xeon E3-1231v3 3Xeon E3-1231v3 4Xeon E3-1231v3 5Xeon E3-1231v3 6</p>
</th>
<th scope="col">
<h3>Ember5</h3>
<p>
Xeon E3-1231v3Xeon E3-1231v3 2Xeon E3-1231v3 3Xeon E3-1231v3 4Xeon E3-1231v3 5Xeon E3-1231v3 6</p>
</th>
<th scope="col">
<h3>Ember6</h3>
<p>
Xeon E3-1231v3Xeon E3-1231v3 2Xeon E3-1231v3 3Xeon E3-1231v3 4Xeon E3-1231v3 5Xeon E3-1231v3 6</p>
</th>
</tr>
</div>