Page 1 of 1

Easy question

Posted: Thu Apr 07, 2005 10:11 am
by chocogrum
Hi! I know this is probably an easy question for many of you but I am new to php and was hoping you can help me. I basically have an online form and have a field where the user enters the cost of the product they wish to buy. There is also a 'Discount' check box. If this is checked, the user gets their product at half price. If the check box is checked, when the submit button is pressed I want the discounted cost to be recorded in my database, not the full cost. I was trying to use an equation like this:

Code: Select all

$subtotal = $HTTP_POST_VARSї'cost'] - $HTTP_POST_VARSї'cost'] * $HTTP_POST_VARSї'discount'] * 0.5
Then submit it using the line:

Code: Select all

GetSQLValueString($total, &quote;double&quote;)
The information is stored in the database fine if I just submit the cost as is entered but when I try to use the code above, the page won't even load when I try to access it. I have looked at many online sources and cannot seem to find an answer that wouldn't require ordering and reading books.

Thanks in advance for any help!

Posted: Thu Apr 07, 2005 10:16 am
by timvw
first you calculate $subtotal..... and then use (uninitialised) $total?

Posted: Thu Apr 14, 2005 4:19 pm
by feyd
if you come back chocogrum, please have a read through the "Posting Code Guidelines" linked to ... everywhere.. (posting pages, my signature, in many many many many posts)