I am quite new to php. Can somebody please guide me what is wrong with the code.
<?php
if(!isset($_POST['submit']) || $_POST['submit']!="calculate")
{
$_POST['Contrib']="";
$_POST['Currentage']="";
$_POST['Retireage']="";
$Total =0;
$AnnGain =7;
}else{
$AnnGain = $_POST['AnnGain'];
$Years = $_POST['Retireage'] - $_POST['Currentage'];
$YearCount = 0;
$Total = $_POST['Contrib'];
while ($YearCount < $Years)
{
$Total = (round($Total) *(1.0 + $AnnGain/100) +
$_POST['Contrib']);
$YearCount = $YearCount+1;
}
}
?>
<b>A Retirement Saving calculator</b>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<p> Your age now
<input type="text" size = "5" name = "Currentage"
value="<?php echo $_POST['Currentage'];?>">
<p> The age at which you want to retire
<Input type="text" SIZE="6" name="Retireage"
value="<?php echo $_POST['Retireage']; ?>">
<p> Annual Contribution
<input type="text" size = "15" name = "Contrib"
value="<?php echo $_POST['Contrib'];?>">
<p>Annual Return
<input type = "text" size = "5" NAME = "AnnGain"
value="<?php echo$AnnGain; ?>">
<BR><BR>
<p><b>Nest Egg </b>: <?php echo $Total; ?>
<p><Input type = "submit" Name = "submit" value = "calculate">
</form>