实例
<!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>
运行实例 »
点击 "运行实例" 按钮查看在线实例