Greetings Newbies:
Ok, this thing is almost there : )
This part is supossed to:
create rows dynamically through a loop (done that)
remember the user-entered-values while the form posts to itself
I know it should be done by echoing the amount entered into the field but haven't figured out the syntax for that.
provide a "Total" (addition of values entered in each row of all 3 rows.) (kinda tricky since the rows are looped). I know i'm supossed to append an addition for every iteration --haven't been able to do that.
You may laugh but I worked on this all night long last night. (no kidding).
I understand the concept and know what I should do I just don't know the appropiate syntax needed.
This is my second week trying to figure out PHP, so excuse the mess.
Any constructive tips would be apreciated.
Thank you in advance.
<html>
<head>
<title></title>
</head>
<body>
<table>
<form method="GET" action="success.php">
<?php
// THERE ARE TWO CELLS PER ROW
// TOTAL OF 3 ROWS - HERE'S THE LOOP TO CREATE THEM
for ($i = 1; $i <= 3; $i++)
{
// VARS FOR SOURCE CELL
$source_name = 'source'."$i";
$source_value_=$HTTP_POST_VARS['amount'][$i];
// VARS FOR AMOUNT CELL
$amount_name = 'amount'."$i";
$amount_value_=$HTTP_POST_VARS['amount'][$i];
//.HTML. CODE FOR TABLE
// CODE FOR SOURCE CELL
print'<tr>';
print"<td>";
//VALUE SHOULD ECHO THE SOURCE ENTERED
print "<input_type=text_name=$source_name[$i]_value='$source_value'>";
print" </td>";
// CODE FOR AMOUNT CELL
print"<td>";
//VALUE SHOULD ECHO THE AMOUNT ENTERED
print "<input_type=text_name=$amount_name[$i]_value='$amount_value'>";
print"</td>";
//AMOUNT VALUES SHOULD BE ADDED FOR EACH ITERATION
$total =($amount + $amount);
print "total is . $total";
} // CLOSE FOR
?>
<!------------JUST GOOD OLD HTML SUMIT BUTTON----------->
<tr>
<td width="20%">
<br />
<center>
<font size="-3">
<input type="submit" name="Recalculate" value="Recalculate" >
</font>
</center>
</td>
<td width="20%">
<center>
<font size="-3"> </font>
</center>
</td>
<td width="60%">
<center>
<font size="-3"> </font>
</center>
</td>
</tr>
</table>
</body>
</html>