Running into 5 errors that I can't seem to figure out since I am new to PhP so it's very confusing, this is for homework but I have done a good share I just need to figure out what the issues are will comment the code issues with the code
Issues are commented
I've tried to fix around syntax and ended up breaking things so I went back to it's original
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title> Shippee Credit Interest </title>
</head>
<body>
<h2> Credit Interest Monthly Payments </h2>
<form action="Shippeelab1.php" method="post">
<!-- Input -->
Credit:
<input type="text" value="2157" name="credit">
Interest Rating:
<input type="text" value="26.22" name="interest">
Monthly Payments:
<input type="text" value="65" name="monthly">
<!-- Button -->
<input type="submit" value="Calculate!" name="btnCalc">
</form>
<?php
if (isset ($_POST['btnCalc'])) // 1.Do not Access Superglobal $_POST Array Directly
{
$owe = $_POST['credit']; // 2. Do not Access Superglobal $_POST Array Directly
$interest = $_POST['interest']; //Do not Access Superglobal $_POST Array Directly
$payment = $_POST['monthly']; //Do not Access Superglobal $_POST Array Directly
echo "<table align='left' border='3>";
echo "<th> Months </th>";
echo "<th> Interest </th>";
echo "<th> Still Owed </th>";
//Stored Balance
$CC = $owe;
for ($array = 0; $owe > 0; $i++)
{
//Calulation for Interest
$paid = $owe * $interest / 100 / 12;
//Interest Payments
$bill = $owe + $interestPay;
//Balance Remainder
$remainder = $owe - $payment + $interestPay;
if($paid > $remainder)
{
$remainder = "";
}
echo "<tr>"
$rowMonth = $array + 1; //3. Syntax error variable'$rowMonth'
$rowInterest = '$' .number_format((float)$paid, 2);
$rowRemainder '$'.number_format((float)$remainder, 2);//4. possible syntax error string '$'
echo "<td> $rowMonth </td>";
echo "<td> $rowInterest </td>";
echo "<td> $rowRemainder </td>";
echo "</tr>";
$owe = $balance;
}
echo "</table>";
$total = $CC + $bill;
echo "<br>", "You paid over " .rowMonth, " months equals out to $".number_format((float)$total, 2);
}
else
{
echo "";
}
?>
</body>
</html>
It's just not compiling and that is all I actually need it to do and I still think my syntax and issues are just things in the wrong place. Any help is appreciated.
EDIT My if statment will run but the error I get ends up being This is after changing the code but leaving is set as ($_POST["btnCalc"]))