What is WRONG with my PHP code ??? I am so confused please help .. 10 points for a

Boogyman

New member
good answer? Ok .. I have built this form that calculates taxes with PHP

Here is the form code first :

<html>
<head> <title> Sales Tax Calculator </title> </head>
<body>

<h1> Please enter amount and tax rate </h1>

<form action="calculator.php" method="post">

Amount : &nbsp

<input type="text" name="amount" size="20" />


Tax Rate : &nbsp

<input type="text" name="rate" size="20" />

<input type="submit" value="Submit form" /> &nbsp
<input type="reset" value="Clear form" />
</form>
</body>
</html>

Here is the PHP code

<html>
<head> <title> Sales Tax Calculator </title> </head>
<body>

<h1> The Calculated tax rate is as follows: </h1>

<?php

$calc_rate = $amount + ($amount * ($rate / 100)); ?>

<table border="0">

<tr>
<td> Entered Amount </td>
<td> <?php echo $_POST["amount"]; ?> </td> </tr>
<tr>
<td> Entered Tax Rate: </td>
<td> <?php echo $_POST["rate"]; ?> </td> </tr>
<tr>
<td> Calculated Tax Amount </td>

<td> <?php echo $_POST["calc_rate"]; ?> </td> </tr>

</table>


</body>
</html>

Here is the OUTPUT .. It shows the amount and rate I have entered in the form, but doesn't display the calculated tax amount, which it is supposed to .. WHAT IS WRONG WITH MY CODE???

The Calculated tax rate is as follows:
Entered Amount 1500
Entered Tax Rate: 500
Calculated Tax Amount
 
Back
Top