批改状态:合格
老师批语:
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="UTF-8">
<style type="text/css">
form {
text-align: center;
}
b {
color: cyan;
text-align: center;
}
button {
color: deeppink;
text-align: center;
}
input{
color: palevioletred;
}
h2 {
color: fuchsia;
text-align: center;
}
</style>
<title>表格生成器</title>
</head>
<body>
<h2 >表格生成器 </h2>
<form action="test.php" method="GET">
<b>输入行数</b> <input type="text" name="row"><br/>
<b>输入行列数</b> <input type="text" name="cols"><br/>
<button name="submit" value="提交">提交</button>
</form>
</body>
</html>点击 "运行实例" 按钮查看在线实例
<?php
$row = $_GET['row'];
$cal = $_GET['cols'];
echo "<table border=1 align='center' width='80%'>";
echo '<tr>';
for($i=0;$i<$cal;$i++){
echo '<th>i</th>';
}
echo '</tr>';
// 内容
for($k =0;$k<$row-1;$k++){
echo '<tr>';
for($z =0;$z<$cal;$z++){
echo'<td>1</td>';
}
echo '</tr>';
}
echo '</table>';
?>
<a href="table.html">重置</a>点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号