gema <<<'FORM'
<form action="" method="post">
<input type="number" name = "rows">行
<br />
<input type="number" name = "cols">列
<input type="submit" value="提交";
</form>
FORM;
$baris = isset($_POST['baris']) ? $_POST['rows'] : 3;
$cols = isset($_POST['cols']) ? $_POST['cols'] : 3;
// $rows = $_POST['rows'];
// $cols = $_POST['cols'];
echo '<table border=" 1" cellspacing="0" cellpadding="5">';
$i = 0;
sambil ($i<$rows) {
echo '<tr>';
$j = 0 ;
manakala ($j<$cols) {
echo '<td>'.($i * $cols + $j).'</td>';
$j++;
}
echo '</tr>';
$i++;
}
echo '</table>';
代码如上,获取不刌取不咰埡的
Tukar nilai tindakan dalam borang kepada nama fail semasa, seperti ini<form action="xx.php" method="post">