<html>
<head>
    <title>Latihan Membuat Tabel</title>
</head>
<body>

<h3>Membuat Tabel</h3>
<form action="" method="POST">
    Jumlah Baris  : <input type="text" name="baris" /><br />
    Jumlah Kolom  : <input type="text" name="kolom" /><br />
    <input type="submit" name="create" value="Create" />
</form>

<?php
if (isset($_POST["create"])) {
    $baris = (int) $_POST["baris"];
    $kolom = (int) $_POST["kolom"];
    ?>
    <h3>Tabel hasil :</h3>
    <table border="1" cellpadding="5">
        <?php for ($i = 1; $i <= $baris; $i++): ?>
            <tr>
                <?php for ($j = 1; $j <= $kolom; $j++): ?>
                    <td>baris <?php echo $i; ?> , kolom <?php echo $j; ?></td>
                <?php endfor; ?>
            </tr>
        <?php endfor; ?>
    </table>
    <?php
}
?>

</body>
</html>