I have a problem with an undefined variable, if I define the variable the script does not work correctly, I know it's a simple answer I just can't find it.
Here is my code: ( I use this in a for each loop )
$weight= ($item['weight']*$item['quantity']);
$totalweight = ($totalweight + $weight)
echo $totalweight;
The script works perfect and gives me the correct answerexcept I get an undefined variable error on line 2 $totalweight
I have tried to set the variable it then breaks the calculation.