today i was writing a script for a shopping cart and ofcourse, i need to figure out how to show the sales tax for a price, so i came up with this simple easy to use script you can use for your website if you need to find out how you can get the tax for your state for example.

here is the script: just copy and paste into a text editor like notepad and save it as webune-tax.php then upload to your wesbite and open it with your broswer and see it in action.


<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Sales Tax Function</title>


<p>This Function Script Created By</p>
<p><img src=""></p>
<form name="form1" method="post" action="">

<input type="text" name="price" value="<?php echo $_POST['price']; ?>">
(example: 49.00) <br>

Enter Sales Rate:<br>
<input type="text" name="tax_rate" value="<?php echo $_POST['tax_rate']; ?>">
(example: 8.25) <br>

<input type="submit" name="Submit" value="Submit">
<hr width="200" align="left">

$Subtotal = $_POST['price'];
$Tax = round( (($_POST['price'] * $_POST['tax_rate']) / 100 ), 2);
$Total = ($Tax + $Subtotal);
Subtotal: $<?php echo $Subtotal; ?><br>
Tax : $<?php echo $Tax; ?><br>
Total: $<?php echo $Total; ?><br>

<p align="center"><a href="">More Free PHP Scripts &gt;&gt;</a> </p>