Jump to content

php maths issue........please help a noob (ish)


googlit

Recommended Posts

hi, im trying to edit my shopping basket code to display prices ex-vat (17.5%) and to display the vat amount

 

What i have so far:

 

Price of an item = $Price

quantity of an item = $qty

 

//sum to display vat amount - reduced to two decimal places
£'.round(($Price / 47) * 7, 2).'
//sum to display price ex vat  - reduced to two decimal places
£'.round($Price / 1.175, 2).'

 

what i need to do now is display a sub-total with the following:

 

total price ex-vat - -  Price minus VAT * Qty

total vat amount - - for this i had

 £'.round((($Price / 47) * 7) * $qty, 2).'

which didnt work

 

 

any help would be received well.......

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/205882-php-maths-issueplease-help-a-noob-ish/
Share on other sites

I've just started learning PHP and bought a book and the first thing we had to do was build a shopping cart. We did also happen to have a sub-total included as well.

 

This is the code I'm using for my Sub-total value I've edited it so that it fits the variable name you have given your total price variable.

 

echo "Sub-total: $".number_format($Price,2)."<br />";

I've just started learning PHP and bought a book and the first thing we had to do was build a shopping cart. We did also happen to have a sub-total included as well.

 

This is the code I'm using for my Sub-total value I've edited it so that it fits the variable name you have given your total price variable.

 

echo "Sub-total: $".number_format($Price,2)."<br />";

 

Thanks but all that is is a formated Price from the session with two decimal points, i need something a bit more technical.....

 

which book are you reading? may be woth a look.....

 

thanks for the help.

Ok no problems then.

 

Here is the link for the book that I'm reading - http://www.amazon.co.uk/PHP-MySQL-Development-Developers-Library/dp/0672329166/ref=sr_1_2?ie=UTF8&s=books&qid=1277513297&sr=8-2

 

It's been good so far and I'm learning quite a lot from it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.