at the top you have
$total1 = 'a1' + 'd2' + 'c3' + 'b4' + 'a5';
$total2 = 'b1' + 'a2' + 'd3' + 'c4' + 'b5';
$total3 = 'c1' + 'b2' + 'a3' + 'd4' + 'c5';
$total4 = 'd1' + 'c2' + 'b3' + 'a4' + 'd5';
that wont work as you expect. it really should be
$total1 = $HTTP_POST_VARS['a1'] + $HTTP_POST_VARS['d2'] + $HTTP_POST_VARS['c3'] + $HTTP_POST_VARS['b4'] + $HTTP_POST_VARS['a5'];
for every line.
Then at the bottom you have
<td>Total: <?php print $HTTP_POST_VARS['total1'];?></td>
<td>Total: <?php print $HTTP_POST_VARS['total2'];?></td>
<td>Total: <?php print $HTTP_POST_VARS['total3'];?></td>
<td>Total: <?php print $HTTP_POST_VARS['total4'];?></td>
but those values didnt come from the post, you created them above so it should be
<td>Total: <?php print $total1;?></td>
for each line.
Also if your php version is greater than 4.1.0 its best to use the $POST array instead of $HTTP_POST_VARS since $POST is already global and $HTTP*VARS is deprecated.