0

I have a "while loop" on a PHP page with stuff coming from a DB, how do I make that the content should come as a table with a few row and columns?

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by hemgoyal_1990
0

Search this forum - this has been covered about a million times over the last two months. Just press the Search button at the top (with no search term) - this will take you to the advanced search page.

1
<?php

if (isset($_POST['submit'])) {
    echo "<table width = 90% border = '1' cellspacing = '5' cellpadding = '0'>";
    // set variables from form input
    $rows = $_POST['rows'];
    $columns = $_POST['columns'];
    // loop to create rows
    for ($r = 1; $r <= $rows; $r++) {
        echo "<tr>";
        // loop to create columns
        for ($c = 1; $c <= $columns;$c++) {
            echo "<td>&nbsp;</td> ";
        }     echo "</tr> ";
    }
    echo "</table> ";
}

?>

instead of &nsbp; use your row within that.

Votes + Comments
Answer is nice and clear...
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.