D k
D k

Reputation: 3

use div inside give table

Can I use a div inside the table given here. I can't use the div tag inside foreach.

here is my code

<table border="1" class="table table-stripped table-bordered">
    <thead>
        <tr>
            <td></td>
            <?php foreach($tests as $test){?>
                <td><?php echo $test->name;?></td>
            <?php } ?>
        </tr>
    </thead>
    <tbody>
        <?php foreach($tests[0]->test_attributes as $test_attribute){?>
        <tr>
            <td>
                <?php echo $test![enter image description here][1]_attribute->attribute_name;?>
            </td>
        </tr>
        <?php } ?>
    </tbody>
</table>

Upvotes: 0

Views: 85

Answers (1)

Manish Jangir
Manish Jangir

Reputation: 5437

<table border="1" class="table table-stripped table-bordered">
    <thead>
        <tr>
            <td>&nbsp;</td>
            <?php foreach($tests as $test){?>
                <td><div><?php echo $test->name;?></div></td>
            <?php } ?>
        </tr>
    </thead>
    <tbody>
        <?php foreach($tests[0]->test_attributes as $test_attribute){?>
        <tr>
            <td>
                <div><?php echo test_attribute->attribute_name;?></div>
            </td>
        </tr>
        <?php } ?>
    </tbody>
</table>

enter image description here

Upvotes: 1

Related Questions