I’m making a script calculating income tax.
The income is supposed to be entered through a form and then calculated like below:
[ul][li]If income is less than (or equal to) 8900 kr, 0 kr tax is paid.[/li]
[li]If income is greater than 8900 kr but less than 198700 kr, 100 kr tax is paid.[/li]
[li]If income is greater than (or equal to) 198700 k, 100 kr + 20 % tax is paid on the income over 198700 kr.[/li][/ul]
I don’t know how to incorporate my php to the form in one page.
[php]<?php
function taxCalc($income) {
if ($income > 0 && $income <= 8900) return ‘0kr’;
else if ($income > 8900 && $income < 198700) return ‘100kr’;
else return (100+($income . 198700) * 0.2) . ‘kr’;
}
echo “Du betalar " . taxCalc((float)$_GET[‘income’]) . " i skatt”;
?> [/php]
Help would be apprechiated.