Here's my php. i cant remember if i need a return or not. I'm simple trying to take input from a html form and post the information from it and calculate the shipping and tax. i also didn't remember how to use tabs in php so i made my own with $tabthis; .
<?php
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$city = $_POST["city"];
$province = $_POST["Province"];
$postal = $_POST["postalcode"];
$address = $_POST["Address"];
$tabThis = " ";
$semiTabThis = " ";
$numberOfPizzas = $_POST["numOfPizza"];
$sizeOfPizzas = $_POST["sizeOfPiz"];
$cost = 0;
$ttProduct = 0;
$shipping = 0;
function itemAmountAndTax($cost){
if($numberOfPizzas == 1){
$cost = 5.75;
$ttProduct = $cost;
return $ttproduct;
}
else if($numberOfPizzas == 2){
$cost = 11.50;
$ttProduct = $cost;
}
else if($numberOfPizzas == 3){
$cost = 17.25;
$ttProduct = $cost;
}
else if($numberOfPizzas == 4){
$cost = 23.00;
return $cost;
$ttProduct = $cost;
}
else if($numberOfPizzas == 5){
$cost = 28.75;
$ttProduct = $cost;
}
else if($numberOfPizzas == 6){
$cost = 34.5;
$ttProduct = $cost;
}
else if($numberOfPizzas == 7){
$cost = 40.25;
$ttProduct = $cost;
}
else if($numberOfPizzas == 8){
$cost = 46;
$ttProduct = $cost;
}
else if($numberOfPizzas == 9){
$cost = 51.75;
$ttProduct = $cost;
}
}
function totalCalculator(){
if( $ttProduct > 0.00 || $ttProduct <= 25.00)
{
$shipping = 3.00;
}
else if($ttProduct > 25.01 || $ttProduct < 50.00)
{
$shipping = 4.00;
}
else if($ttProduct > 50.01 || $ttProduct < 75.00)
{
$shipping = 5.00;
}
else if($ttProduct > 75.01)
{
$shipping = 6.00;
}
}
?>
Shipping To: <?php echo $fname; ","; ?> <?php echo $lname; ?><br>
<?php echo $tabThis; ?><?php echo $address; ?><br>
<?php echo $tabThis; ?><?php echo $city; ?><?php echo "" ?><?php echo $province; ?><br>
<?php echo $tabThis; ?><?php echo $postal; ?><br>
Order Information:<br>
<br>
<?php echo $semiTabThis; ?>Your Order is Being Processed, Please verify the information<br>
<?php echo $tabThis; ?><?php echo $numberOfPizzas; ?> Pizza's at <?php?>itemAmountAndTax($cost); each <br>
<?php echo $tabThis; ?>Tax = <?php?><br>
<?php echo $tabThis; ?>Delivery = <?php?><br>
<?php echo $tabThis; ?>Total Cost's = <?php?><br>