לפני 9 חודשים

אשמח לעזרתכם יש פה קוד למחשבון ריבית דריבית שקיבלתי מ gpt והסבתי אותו שיעבוד טלפונית ומשום מה מחזיר שגיאה 500 לא עובד גם בדפדפן
עריכה: כרגע מצאתי ; שחסר אבל בטלפון אחרי שמבקש נתונים חוזר אחורה במקום לחשבן ולהשמיע תוצאות
קישור


// קבלת נתונים מהמשתמש
$principal = $_GET['principal'];
 // סכום ראשוני
$monthlyPayment = $_GET['monthlyPayment']; 
// סכום לכל חודש
$annualInterestRate = $_GET['annualInterestRate']; 
// אחוז תשואה לשנה
$years = $_GET['years'];
 // כמה שנים
if($principal==null){print"read=t-הקישוא את הסכום הראשוני=principal,";
}elseif($monthlyPayment==null){print"read=t-הקש כמה נוסף בחודש=monthlyPayment,";
}elseif($annualInterestRate==null){print"read=t-הקש כמה אחוזים תשואה בשנה=annualInterestRate,";
}elseif($years==null){print"read=t-הקש את מספר השנים להשקעה=years,";}


else{


// חישוב ריבית חודשית
$monthlyInterestRate = $annualInterestRate / 12 / 100;

// חישוב מספר חודשים
$numberOfMonths = $years * 12;

// חישוב סך ההכנסה
$totalInvestment = $principal + ($monthlyPayment * $numberOfMonths);

// חישוב סך הריבית

$totalInterest = 0;
$balance = $principal;
for ($i = 1; $i <= $numberOfMonths; $i++) {
  $interest = $balance * $monthlyInterestRate;
  $totalInterest += $interest;
  $balance += $monthlyPayment + $interest;
}

// הדפסת התוצאות


$totalos=$totalInvestment + $totalInterest;
    $totalos = str_replace("." , ".t-נקודה.d-" , $totalos);
    $totalInterest = str_replace("." , ".t-נקודה.d-" , $totalInterest);

print "id_list_message=t-להלן התוצאות,הסכום הראשוני הוא  .n-$principal";
print".t- תשלום חודשי .n-$monthlyPayment";
print".t- על ידי  .n-$annualInterestRate.t- אחוזים למשך .n-$years.t- שנים שהם .n-$numberOfMonths.t- חודשים, סך הכל הכנסה ";
print".n-$totalInvestment";
print".t-סך הכל רווח ";
print".n-$totalInterest";
print".t- סך הכל למשיכה "; 
print".n-$totalos";
//עבור הדפדפן
print "<h2>תוצאות</h2>";
print "<h3>סכום ראשוני:</h3>" . $principal . "<br>";
print "<h3>תשלום חודשי:</h3>" . $monthlyPayment . "<br>";
print "<h3>אחוז תשואה שנתית:</h3>" . $annualInterestRate . "%<br>";
print "<h3>משך ההשקעה:</h3>" . $years . " שנים (" . $numberOfMonths . " חודשים)<br>";
print "<h3>סך ההכנסה:</h3>" . number_format($totalInvestment, 2, ".", ",") . "<br>";
print "<h3>רווח:</h3>" . number_format($totalInterest, 2, ".", ",") . "<br>";
print "<h3>סך הכל:</h3>" . number_format($totalInvestment + $totalInterest, 2, ".", ",") . "<br>";




}