I seem to have a parse error here.
${$row['header']}count = ${$row['header']}count + $_POST[$row['header']][$count]['qty'];
Does anyone see a problem?
I suspect the word "count" should be on the end of that variable? Try this:
${$row['header']."count"} += $_POST[$row['header']][$count]['qty'];