Math code to Deduct 15% Discount of Total

How can I get the total to automatically deduct 15%? Here’s the code base:

[php]

            <tr >
              <td width="163">Product</td>
              <td width="134" nowrap="nowrap">Payment Method </td>
              <td width="46">Price</td>
              <td width="56">Qty</td>
              <td width="48">Total</td>
              <td width="59">Remove</td>
            </tr>
            <?php

for ( $counter = 1; $counter <= $_SESSION[“cnt”]; $counter += 1)
{
if(($counter%2)==0)
{
?>


<?php
}
?>







<?php
}
?>




















<?php echo($_SESSION["title".$counter]); ?> <?php echo($_SESSION["paymentmethod".$counter]); ?> $<?php echo($_SESSION["price".$counter]); ?> <?php echo($_SESSION["qty".$counter]); ?> $<?php echo($_SESSION["total".$counter]); ?>
  Sub Total: $<?php echo($_SESSION["grandtotal"]); ?>  
- Discount %: 15  
Shipping:
$0  
Grand Total: $<?php
function add($x,$y)
{
$total=$x+$y;
return $total;
}

echo add($_SESSION[“grandtotal”],0);
?>

[/php]

With a little simple math?

[php]
$price = 100;
$discount = $price * .15;
$total = $price - $discount;
[/php]

Thank you. But how to integrate this code? Sorry but I am not that savvy to integrate orange to apple so to speak. I need the exact code as it would be included in the base sample I gave… pls…

This doesn’t work but maybe something like this will work?

[php]<?php $price = “grandtotal”;(
$discount = $price * .15
$total = $price - $discount;) echo($_SESSION[“discount”]); ?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service