As bernouli pointed out, your original error was using '=' instead of '+=', but just for grins I will post yet another way to do it....
for ($a=1; $a<=$calculate; $a++){
$total += ${'quantity'.$a};
}
By the way, in PHP you will find it more common to name such variables with square brackets (i.e. quantity[]) which PHP will accept as an array. Your approach, using variable variables, is a bit more work but happens to be the method that usually appeals to me. Not sure why, probably because brackets don't seem to belong inside forms. They look funny to me as input names and I just don't trust them 😃
In the case of check boxes, though, giving each checkbox a different name is not too elegant a solution either. In that case I usually use the array method.