View Full Version : Getting undefined variable.. why?

Oct 12th, 2011, 11:39 AM
I'm getting:

PHP Notice: Undefined variable: carttotal

... for this:

$idtotal = $sizestotal + $sizemtotal + $sizeltotal + $sizexltotal;
$carttotal += $idtotal;


Oct 12th, 2011, 11:46 AM
$carttotal = +$idtotal;

EDIT: While this stopped the PHP notice, it made my calculation thing stop working.

Oct 12th, 2011, 12:19 PM
At the top of your code do this:
$carttotal = 0;

Otherwise when you use += it expects there to be a value to add to - and there isn't if its null is there.

Oct 12th, 2011, 12:39 PM
tangoforce, your talent impresses me every time!

Oct 12th, 2011, 12:43 PM
If my website takes off how I imagine it will, expect high-end clothing coming your way of your choice, free of charge.

Its too bad this there isn't a coding forum where there is a "tip" concept setup, so you can tip someone to their PayPal account or something to say thank you.
A cool concept I've had on my mind for the past month, but I know I will never get around to making it.

Oct 12th, 2011, 01:07 PM
Heh.. I should add a paypal link to my sig :D

Oct 12th, 2011, 01:27 PM
So do it man!