The exercise I was asked to do for a PHP class, gave instructions to create a PHP form that would call back and display the same user data entered.
Meaning, it would retain the values submitted and just display them back again to the user.
The form had other instructions too, such as totaling an 'Amount' column and creating an if/else statement to check for non-numeric values placed in the 'Amount' column.
If errors are detected in the non-numeric values it is supposed to display an error message and then total up the number of errors on the form.
I was having trouble with the if/else statement:
<table>
<?php
// ERROR COLUMN OF THE TABLE
for ($row=1; $row<5; $row++)
{
$value_of_amount = '$amount_cell'.$row;
$value_of_amount = $_POST['value_of_amount'];
if (is_numeric($value_of_amount))
{
echo "<tr><td> $value_of_amount </td></tr>";
} else {
echo "<tr><td> Value is not a number </td></tr>";
}
}
?>
</table>
To my understanding, the syntax of this PHP statement appears to be correct, but I'm not sure.....
As a novice, this is all very confusing to me, but I thank you for your reply. - Kimberly