I'm trying to update a table with the user's request entered in a text box. So if a user wanted to have 5 rows to enter in data in an order form, they would type in '5' in the text box, hit the update button and it would populate the table with 5 rows. I believe I have the logic down in my code, but for some reason it isn't updating. Any ideas why?
<table>
<tr>
<th class="textCol">Product Rows:</th>
<td class="inputCol"><input type="text" name="rows"></td>
<td><input class="update" type="button" name="update" value="Update"></td>
<td class="inputCol"></td>
</tr>
</table>
<table class="bottomTable">
<tr>
<th class="textCol">Product</th>
<th class="textCol">Quantity</th>
<th class="textCol">Unit Price</th>
<th class="textCol">Total Price</th>
</tr>
<?
if (isset($_POST['update']))
{
//Execute this code if the update button is clicked.
$num = $_POST['rows'];
for ($i=0; $i<$num; $i++) { ?>
echo "<tr>
<td class="inputCol2"><input type="text" name="product[$i]" ></td>
<td class="inputCol2"><input type="text" name="quantity[$i]" ></td>
<td class="inputCol2">$<input type="text" name="unit[$i]" ></td>
<td class="inputCol2">$<input type="text" name="total[$i]" ></td>
</tr>";
<? } ?>
<? } else {?>
<tr>
<td class="textCol"></td>
<td class="textCol"></td>
<td class="textCol">Total Order:</td>
<td class="inputCol2">$<input type="text" name="total6"></td>
</tr>
<? } ?>
</table>