Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

List horizontally data from array

enter image description here

This is the result I’ve got. But I wan to display it horizontally. Can anyone help me?
Here’s my code:

<?php
for($j = 0; $j < count($sub); $j++){
     echo "
        <table class='table'>
            <thead>
                <tr>
                    <th scope='col'>" . $sub[$j] . "</th>
                </tr>
             </thead>
        </table>";
}
                           

?>

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Your subjects should be ths in one tr:

echo "<table class='table'><thead><tr>";
for($j = 0; $j < count($sub); $j++){
    echo "<th scope='col'>" . $sub[$j] . "</th>";
}
echo "</tr></thead></table>";

Fiddle here.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading