Issue with the program for calculating the salaries

I have wrote a code to calculate salaries. Total salary(net income) paid in gross income diminished by tax and pension insurance payment (4.30%). I have pasted the code. I didin’t get proper output

Calculate Salary
<fieldset style="width: 30rem; border-style: double; border-width: 5px;">
	<legend>Enter Salary Details</legend>
		<label>Enter Gross Salary</label>
		<input type="number" name="numsal"><br><br>
		<label>Enter Tax</label>
		<input type="number" name="numtax"><br><br>
		<input type="submit" name="submit" value="Calculate">
			function calsalary($gross, $tax)
				$calsalary = $gross - $tax - (4.30 * 100);
				return $calsalary;
			if (isset($_POST['submit'])) 
				$net = $_POST['numsal'];
				$saltax = $_POST['numtax'];
				$total = calsalary($net,$saltax);
				echo "You entered ".$net." as your Gross Salary";
				echo $saltax." is tax which is deducted";
				echo "<b>Your total salary is ".$total."</b>";
				return 0;
  1. you doing $_POST then why your code missing this will give your output.

  2. Elaborate clearly what is your math calculation steps i feel its confusing to me because 4.3% you telling then why 4.30 * 100 you doing.

click like :heart: & happy coding

1 Like