0
我正在做的事情可能非常愚蠢,想知道如果我能讓任何人指出我做錯了什麼。教我自己的PHP,並在這樣做,我試圖做一個工資計算器。它給了我這些結果:基本的PHP表格計算問題
Your results:
29 years old earning
$205per day working
$5days a week at a
Your total earned money at age 65 is $0.
While your yearly income is
49200
雖然很明顯總賺錢的數字是不正確的。 0是不正確的。
下面是完整的代碼
<?php
//get the values from the $_POST array
$age = $_POST['age'];
$days = $_POST['days'];
$pay = $_POST['pay'];
//calculate the total:
$howold = 65 - $age;
$retireageincome = $yearlyincome * $howold;
$yearlyincome = $pay * $days * 4 * 12;
//print out results
print "<p>Your results:<br>
<span class=\"number\">$age</span> years old earning <br>
$<span class=\"number\">$pay</span>per day working <br>
$<span class=\"number\">$days</span>days a week at a<br>
Your total earned money at age 65 is $<span class=\"number
\">$retireageincome</span>.<br>
While your yearly income is <br>
<span class=\"number\">$yearlyincome</span> </p>";
?>
</body>
</html>
仔細查看你的代碼和/或打開錯誤報告,你會看到你的問題。 – WheatBeak
$ retireageincome在$ annualincome後得到計算...我認爲您的訂單已關閉... – VA79
謝謝。我其實甚至沒有意識到變量的順序。 – daytradeit