我有一个网页(从 PHP 文件中创建)需要显示一个 30 行长的表格,并允许用户为 30 行中的每一行输入值,然后按一个按钮让 php 处理他们输入的内容。
无论如何,不必用一个有 30 行的表格写出一个普通的 HTML 表单,我想知道他们是否有任何方法可以用更少的代码在 PHP 中创建这个表格。
所以它看起来像
<form name="createtable" action="?page=createtable" method="POST" autocomplete="off">
<table border='1'>
<tr>
<th> Weight </th>
<th> CBM Min </th>
<th> CBM Max </th>
<th> Min </th>
</tr>
<tr>
<th> 1000 </th>
<th> 0.1 </th>
<th> 2.3 </th>
<th> <input type=text name=min1> </th>
</tr>
<tr>
<th> 1500 </th>
<th> 2.31 </th>
<th> 3.5 </th>
<th> <input type=text name=min2> </th>
</tr>
<tr>
<th> 2000 </th>
<th> 3.51 </th>
<th> 4.6 </th>
<th> <input type=text name=min3> </th>
</tr>
..... + 27 more rows
</table>
</form>
我目前只是像上面一样写出完整的表格,重量、cbm min 和 max 的值没有以标准速率增加,所以我猜正常循环不起作用,这些值可以放入数组中吗?我的 php 很生锈