I have a form with one input (profit)
I also have calculations that work out how much tax to pay and calculates ni contributions
this form works ok except for one small problem.
Example if you input 60000 into the input box and submit the results should echo
Estimated Tax = £11500
Class 2 National Insurance = £159.00
Class 4 National Insurance Low Rate = £3645.00
Class 4 National Insurance High Rate = £200.00
At the moment it shows
Estimated Tax = £11500
Class 2 National Insurance = £159.00
Class 4 National Insurance High Rate = £200.00
it does not show Class 4 National Insurance Low Rate = £3645.00
also how do i then add the totals up to display a grand total for example
Estimated Tax = £11500
Class 2 National Insurance = £159.00
Class 4 National Insurance Low Rate = £3645.00
Class 4 National Insurance High Rate = £200.00
Grand Total = £15504
here is the form action page …
<?php
if(isset($_POST["profit"])){$profit =($_POST["profit"]);}
$nilowrate=$nilowrate;
$nihighrate=$nihighrate;
//Class 4 Low Rate
$nilow=$profit-9500;
$nilowrate=$nilow/100*9;
//Class 4 High Rate
$nihigh=$profit-50000;
$nihighrate=$nihigh/100*2;
// Less Than 50,000
$profit1=$profit-12500;
$profit1calc=$profit1/100*20;
// Between 50,001 and 100,000
$profit2=$profit-50000;
$profit2a=$profit2/100*40;
$profit2calc=$profit2a+7500;
// Between 100,000 and 101,000
$profit3=$profit-49500;
$profit3a=$profit3/100*40;
$profit3calc=$profit3a+7500;
// Between 101,000 and 102,000
$profit4=$profit-49000;
$profit4a=$profit4/100*40;
$profit4calc=$profit4a+7500;
// Between 102,000 and 103,000
$profit5=$profit-48500;
$profit5a=$profit5/100*40;
$profit5calc=$profit5a+7500;
// Between 103,000 and 104,000
$profit6=$profit-48000;
$profit6a=$profit6/100*40;
$profit6calc=$profit6a+7500;
// Between 104,000 and 105,000
$profit7=$profit-47500;
$profit7a=$profit7/100*40;
$profit7calc=$profit7a+7500;
// Between 105,000 and 106,000
$profit8=$profit-47000;
$profit8a=$profit8/100*40;
$profit8calc=$profit8a+7500;
// Between 106,000 and 107,000
$profit9=$profit-46500;
$profit9a=$profit9/100*40;
$profit9calc=$profit9a+7500;
// Between 107,000 and 108,000
$profit10=$profit-46000;
$profit10a=$profit10/100*40;
$profit10calc=$profit10a+7500;
// Between 108,000 and 109,000
$profit11=$profit-45500;
$profit11a=$profit11/100*40;
$profit11calc=$profit11a+7500;
// Between 109,000 and 110,000
$profit12=$profit-45000;
$profit12a=$profit12/100*40;
$profit12calc=$profit12a+7500;
// Between 110,000 and 111,000
$profit13=$profit-44500;
$profit13a=$profit13/100*40;
$profit13calc=$profit13a+7500;
// Between 111,000 and 112,000
$profit14=$profit-44000;
$profit14a=$profit14/100*40;
$profit14calc=$profit14a+7500;
// Between 112,000 and 113,000
$profit15=$profit-43500;
$profit15a=$profit15/100*40;
$profit15calc=$profit15a+7500;
// Between 113,000 and 114,000
$profit16=$profit-43000;
$profit16a=$profit16/100*40;
$profit16calc=$profit16a+7500;
// Between 114,000 and 115,000
$profit17=$profit-42500;
$profit17a=$profit17/100*40;
$profit17calc=$profit17a+7500;
// Between 115,000 and 116,000
$profit18=$profit-42000;
$profit18a=$profit18/100*40;
$profit18calc=$profit18a+7500;
// Between 116,000 and 117,000
$profit19=$profit-41500;
$profit19a=$profit19/100*40;
$profit19calc=$profit19a+7500;
// Between 117,000 and 118,000
$profit20=$profit-41000;
$profit20a=$profit20/100*40;
$profit20calc=$profit20a+7500;
// Between 118,000 and 119,000
$profit21=$profit-40500;
$profit21a=$profit21/100*40;
$profit21calc=$profit21a+7500;
// Between 119,000 and 120,000
$profit22=$profit-40000;
$profit22a=$profit22/100*40;
$profit22calc=$profit22a+7500;
// Between 120,000 and 121,000
$profit23=$profit-39500;
$profit23a=$profit23/100*40;
$profit23calc=$profit23a+7500;
// Between 121,000 and 122,000
$profit24=$profit-39000;
$profit24a=$profit24/100*40;
$profit24calc=$profit24a+7500;
// Between 122,000 and 123,000
$profit25=$profit-38500;
$profit25a=$profit25/100*40;
$profit25calc=$profit25a+7500;
// Between 123,000 and 124,000
$profit26=$profit-38000;
$profit26a=$profit26/100*40;
$profit26calc=$profit26a+7500;
// Between 124,000 and 125,000
$profit27=$profit-37500;
$profit27a=$profit27/100*40;
$profit27calc=$profit27a+7500;
// Between 125,000 and 150,000
$profit28=$profit-37500;
$profit28a=$profit28/100*40;
$profit28calc=$profit28a+7500;
// Over 150,000
$profit29=$profit-150000;
$profit29a=$profit29/100*45;
$profit29calc=$profit29a+52500;
if ($profit < 12500) {echo "Estimated Tax = £ 0";}
elseif ($profit <= 50000) {echo "Estimated Tax = £ $profit1calc ";}
elseif ($profit >= 50001 && $profit <= 100000) {echo "Estimated Tax = £ $profit2calc ";}
elseif ($profit >= 100001 && $profit <= 101000) {echo "Estimated Tax = £ $profit3calc ";}
elseif ($profit >= 101001 && $profit <= 102000) {echo "Estimated Tax = £ $profit4calc ";}
elseif ($profit >= 102001 && $profit <= 103000) {echo "Estimated Tax = £ $profit5calc ";}
elseif ($profit >= 103001 && $profit <= 104000) {echo "Estimated Tax = £ $profit6calc ";}
elseif ($profit >= 104001 && $profit <= 105000) {echo "Estimated Tax = £ $profit7calc ";}
elseif ($profit >= 105001 && $profit <= 106000) {echo "Estimated Tax = £ $profit8calc ";}
elseif ($profit >= 106001 && $profit <= 107000) {echo "Estimated Tax = £ $profit9calc ";}
elseif ($profit >= 107001 && $profit <= 108000) {echo "Estimated Tax = £ $profit10calc ";}
elseif ($profit >= 108001 && $profit <= 109000) {echo "Estimated Tax = £ $profit11calc ";}
elseif ($profit >= 109001 && $profit <= 110000) {echo "Estimated Tax = £ $profit12calc ";}
elseif ($profit >= 110001 && $profit <= 111000) {echo "Estimated Tax = £ $profit13calc ";}
elseif ($profit >= 111001 && $profit <= 112000) {echo "Estimated Tax = £ $profit14calc ";}
elseif ($profit >= 112001 && $profit <= 113000) {echo "Estimated Tax = £ $profit15calc ";}
elseif ($profit >= 113001 && $profit <= 114000) {echo "Estimated Tax = £ $profit16calc ";}
elseif ($profit >= 114001 && $profit <= 115000) {echo "Estimated Tax = £ $profit17calc ";}
elseif ($profit >= 115001 && $profit <= 116000) {echo "Estimated Tax = £ $profit18calc ";}
elseif ($profit >= 116001 && $profit <= 117000) {echo "Estimated Tax = £ $profit19calc ";}
elseif ($profit >= 117001 && $profit <= 118000) {echo "Estimated Tax = £ $profit20calc ";}
elseif ($profit >= 118001 && $profit <= 119000) {echo "Estimated Tax = £ $profit21calc ";}
elseif ($profit >= 119001 && $profit <= 120000) {echo "Estimated Tax = £ $profit22calc ";}
elseif ($profit >= 120001 && $profit <= 121000) {echo "Estimated Tax = £ $profit23calc ";}
elseif ($profit >= 121001 && $profit <= 122000) {echo "Estimated Tax = £ $profit24calc ";}
elseif ($profit >= 122001 && $profit <= 123000) {echo "Estimated Tax = £ $profit25calc ";}
elseif ($profit >= 123001 && $profit <= 124000) {echo "Estimated Tax = £ $profit26calc ";}
elseif ($profit >= 124001 && $profit <= 125000) {echo "Estimated Tax = £ $profit27calc ";}
elseif ($profit >= 125001 && $profit <= 150000) {echo "Estimated Tax = £ $profit28calc ";}
elseif ($profit >= 150001) {echo "Estimated Tax = £ $profit29calc ";}
echo "<br><br>";
if ($profit < 6475){echo "Class 2 National Insurance = £ 0";}
else {echo "Class 2 National Insurance = £ 159.00";}
echo "<br><br>";
if ($profit < 9500){echo "Class 4 National Insurance = £ 0";}
if ($profit >= 9501 && $profit <= 50000){echo "Class 4 National Insurance Low Rate = £ $nilowrate";}
if ($profit >= 50001){echo "Class 4 National Insurance High Rate = £ $nihighrate";}
?>
Thanks