Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Cetak Table</title>
- </head>
- <body>
- <form action="" method="POST">
- <table border="1">
- <tr>
- <td colspan="2" align="center">Input Data</td>
- </tr>
- <tr>
- <td>Kolom</td>
- <td><input type="text" name="kolom" value="" /></td>
- </tr>
- <tr>
- <td>Baris</td>
- <td><input type="text" name="baris" value="" /></td>
- </tr>
- <tr>
- <td colspan="2" align="right"><input type="submit" name="proses" value="PROSES" /></td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- <?php
- if(isset($_POST['proses'])){
- $kolom = (int)$_POST['kolom'];
- $baris = (int)$_POST['baris'];
- echo "<table border=1>";
- for($row=1;$row<=$baris;$row++){
- echo "<tr>";
- for($col=1;$col<=$kolom;$col++){
- echo "<td>kolom $col baris $row</td>";
- }
- echo "</tr>";
- }
- echo "</table>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement