Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    274
    Thanks
    38
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Jul 2010
    Location
    Oregon City
    Posts
    280
    Thanks
    5
    Thanked 50 Times in 49 Posts
    Can you give some example output?

  • Users who have thanked Adee for this post:

    FlashDance (10-21-2011)

  • #3
    Regular Coder
    Join Date
    Sep 2011
    Posts
    274
    Thanks
    38
    Thanked 0 Times in 0 Posts
    Never mind, it worked.. had some weird cookie issue.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •