This is probably so easy to do, but I have been trying for two days to find out what I have been doing wrong.
The scenario is - I am setting up a t-shirt company's website, and he wants to be able to offer certain customers a certain percentage discount off the price of a shirt.
I have set up a login screen where people put in their code, which is registered as a session variable, and passed through to the page. I linked this to the cutstomer details page successfully, so that I can show the discount, the customer name etc, but when I try to take the discount off the price, the number does not show up - it is driving me mad!
Here is the code snippet, the recordset LIST is the product details, the recordset DISCOUNT contains the discount details.
Code: Select all
<?php
// Show IF Conditional region3
if (@$row_LIST['ID'] != "") {
?>
<p><span class="style2"><strong><a href="images/<?php echo $row_LIST['IMAGE']; ?>" target="_blank"><img src="images/th<?php echo $row_LIST['IMAGE']; ?>" alt="<?php echo $row_LIST['PRODUCT_NAME']; ?>" border="0" class="floatLeftClear" /></a><?php echo $row_LIST['PRODUCT_NAME']; ?>
<?php
function percent() {
$price = $row_LIST['COST'];
$discount = $row_DISCOUNT['DISCOUNT'];
$count1 = ($price / 100);
$count2 = (100 - $discount);
$count3 = ($count1 * $count2);
$total += number_format($count3, 2);
echo ("- $".$total." ");
}
?>
</strong></span> </p>
<p><span class="style3">*Shipping costs will be shown before confirmation of order</span><br />
<span class="style3"><em>(tax is charged for sales within North Carolina)</em></span></p>
<p class="style2"><?php echo $row_LIST['DESCRIPTION']; ?></p>
<?php
// else Conditional region3
} else { ?>
Currently there are no products to view in this category.
<?php }
?>
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: