Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-21-2011, 10:26 AM   PM User | #1
FlashDance
Regular Coder

 
Join Date: Sep 2011
Posts: 274
Thanks: 38
Thanked 0 Times in 0 Posts
FlashDance can only hope to improve
Arithmetic code not working

I've written this code and echoed everything and everything is coming out right, but the math isn't happening. Can anyone see why?

PHP Code:
$totalbeforequantity $_SESSION['cart']['content'][$_POST['id']]['sizes'] + $_SESSION['cart']['content'][$_POST['id']]['sizem'] + $_SESSION['cart']['content'][$_POST['id']]['sizel'] + $_SESSION['cart']['content'][$_POST['id']]['sizexl'];
    
$beforeprice $totalbeforequantity $row['price'];
    
$_SESSION['cart']['total'] -= $beforeprice;
    
$_SESSION['cart']['content'][$_POST['id']]['sizes'] = $_POST['quantitys'];
    
$_SESSION['cart']['content'][$_POST['id']]['sizem'] = $_POST['quantitym'];
    
$_SESSION['cart']['content'][$_POST['id']]['sizel'] = $_POST['quantityl'];
    
$_SESSION['cart']['content'][$_POST['id']]['sizexl'] = $_POST['quantityxl'];
    
$totalafterquantity $_SESSION['cart']['content'][$_POST['id']]['sizes'] + $_SESSION['cart']['content'][$_POST['id']]['sizem'] + $_SESSION['cart']['content'][$_POST['id']]['sizel'] + $_SESSION['cart']['content'][$_POST['id']]['sizexl'];
    
$afterprice $totalafterquantity $row['price'];
    
$_SESSION['cart']['total'] += $afterprice
FlashDance is offline   Reply With Quote
Old 10-21-2011, 10:59 AM   PM User | #2
Adee
Regular Coder

 
Join Date: Jul 2010
Location: Oregon City
Posts: 280
Thanks: 5
Thanked 50 Times in 49 Posts
Adee can only hope to improve
Can you give some example output?
Adee is offline   Reply With Quote
Users who have thanked Adee for this post:
FlashDance (10-21-2011)
Old 10-21-2011, 11:00 AM   PM User | #3
FlashDance
Regular Coder

 
Join Date: Sep 2011
Posts: 274
Thanks: 38
Thanked 0 Times in 0 Posts
FlashDance can only hope to improve
Never mind, it worked.. had some weird cookie issue.
FlashDance is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:40 AM.


Advertisement
Log in to turn off these ads.