Simplyfy HTML Table code using PHP
I have a webpage (created from within PHP files) that needs to display a
table that is 30 rows long and allows the user to enter values for each of
the 30 rows and then press a button to let php process what they have
entered.
Anyway instead of having to write out a normal HTML form with a table that
has 30 rows I wonder if their is any way to create this table in PHP with
much less code.
SO as it is it looks something like
<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>
I am currently just writing out the complete table like above, the values
for weight, cbm min and max are not increasing at a standard rate so a
normal loop would not work I guess, could these values be put into an
array perhaps? My php is very rusty
No comments:
Post a Comment