<<<<<<<<<<==============>>>>>>>>>
KODE HTML BOS
<html>
<head>
<title>php tabel generated</title>
</head>
<body>
<form method="post">
<p> <strong>Baris : </strong>
<input name="cel" type="text" value="15" /></p>//nilai default field baris
<p> <strong>Kolom : </strong>
<input name="col" type="text" value="2" /></p>//nilai defaut field kolom
<p> <input type="submit" name="click" value="Generate" /></p>
</form>
<?php
$clicked = $_POST['click'];
if (isset($clicked)) {
//deklarasi variabel baris dan kolom
$cel = (int) $_POST['cel'];
$col = (int) $_POST['col'];
//perulangan border tabel
echo '<table border="1px" cellspacing="0">
<tr>';
for ($count=1; $count<=$cel; $count++) {
echo '<td width=\"50\" height=\"50\">'.$count.'</td>';
if ($count % $col == 0) echo '</tr><tr>';
}
echo '</tr></table>';
}
?>
</body>
</html>
<head>
<title>php tabel generated</title>
</head>
<body>
<form method="post">
<p> <strong>Baris : </strong>
<input name="cel" type="text" value="15" /></p>//nilai default field baris
<p> <strong>Kolom : </strong>
<input name="col" type="text" value="2" /></p>//nilai defaut field kolom
<p> <input type="submit" name="click" value="Generate" /></p>
</form>
<?php
$clicked = $_POST['click'];
if (isset($clicked)) {
//deklarasi variabel baris dan kolom
$cel = (int) $_POST['cel'];
$col = (int) $_POST['col'];
//perulangan border tabel
echo '<table border="1px" cellspacing="0">
<tr>';
for ($count=1; $count<=$cel; $count++) {
echo '<td width=\"50\" height=\"50\">'.$count.'</td>';
if ($count % $col == 0) echo '</tr><tr>';
}
echo '</tr></table>';
}
?>
</body>
</html>
Tidak ada komentar:
Posting Komentar