Need help with a calculation...
Posted: Thu Dec 15, 2005 4:19 am
I've got a shipping calculation that goes like this:
but I need to add another calculation, IF the order is from a country other that the U.S. - something like,
if ($country is NOT USA, * .25)
I still need the other two parts to work the same as they have been if the order is from the U.S, but need to multiply $total by 25% if outside of the US, regardless of $total...
so, in non-php terms... IF $country is USA, AND $total > 81.75, printf $total * .11,
but IF $ country is NOT USA, printf $total * .25
also needs to go into a hidden field to pass to the next page...
Don't know how to write multiple IFs...
Any/all help appreciated...
thanks in advance.
mc
Code: Select all
Shipping: <?php if ($total > 81.75) {printf ("%01.2f", $total * .11);}else {echo "8.99 ";}?>if ($country is NOT USA, * .25)
I still need the other two parts to work the same as they have been if the order is from the U.S, but need to multiply $total by 25% if outside of the US, regardless of $total...
so, in non-php terms... IF $country is USA, AND $total > 81.75, printf $total * .11,
but IF $ country is NOT USA, printf $total * .25
also needs to go into a hidden field to pass to the next page...
Code: Select all
<input type="hidden" name="shipping" value="<?php if ($total > 81.75) {printf ("%01.2f", $total * .11);} else {echo "8.99 ";}?>">Any/all help appreciated...
thanks in advance.
mc