How to add shipping value to the total?
Posted: Mon Apr 30, 2007 1:58 pm
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hey,
I have a pretty simple question but I'm having a hard time finding a workabout/solution on the net. I'm new at this so I don't know all the tricks and turns. What I'm trying to accomplish is:
Take the value of the desired shipping selected and onchange, add that value (either 7$ or 15$) to the total. Thanks
Here is the codeCode: Select all
<?php
define("SUB_TOTAL","Sub-Total: ");
define("_GST","Tax(6%): ");
define("_TOTAL","Total: ");
$totalCost = 50;
$gstTax = 0.06;
?>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="27"> <div align="right"><font face="verdana" size="1" color="black"><?php echo SUB_TOTAL; ?>
$<?php echo number_format($totalCost, 2, ".", ","); ?> </font> </div></td>
</tr>
<tr>
<td height="18"><div align="right"><font face="verdana" size="1" color="black"><?php echo _GST; ?>
$
<?php
$sum=$totalCost * $gstTax;
echo number_format($sum, 2, ".", ",");?>
</font></div></td>
</tr>
<tr>
<td><div align="right"><font face="verdana" size="1" color="black"> <br>
<select name="shipping">
<option value="7">Shipping Local 7$</option>
<option value="15">Shipping Surrounding 15$</option>
</select>
<br>
<br>
</font> </div>
<div align="right"><font face="verdana" size="1" color="black"><b><?php echo _TOTAL; ?>$
<?php
$total=$sum + $totalCost;
echo number_format($total, 2, ".", ",");?>
</b></font></div></td>
</tr>
</table>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]