I have 4 checkboxes in my form.Each one has a different value.When a user selects,let's say 2 of them and submits the form I need to output the sum total of the selected checkboxes.

This is how my form looks like:
HTML Code:
<form name="form1" method="post" action="unos.php" 
 <input type="checkbox" name="cb1" value="355">HP DESKJET D2660
 <input type="checkbox" name="cb2" value="300">HP DESKJET D1560
 <input type="checkbox" name="cb3" value="420">HP DESKJET 6940
 <input type="checkbox" name="cb4" value="450">HP OFFICEJET 6000

<input name="ime" type="text" id="Text1" style="position: absolute" />
<input name="prezime" type="text" id="Text2" style="position: absolute" />
 <input name="adresa" type="text" id="Text3" style="position: absolute" />
<input type="submit" name="Submit" value="OK" style="position: absolute; top: 812px; left: 375px;">
And this is my unos.php:

PHP Code:
<?php
$konekcija 
mysql_connect($host,$user,$pass)
or die (
'Povezivanje sa serverom nije uspjelo!');

mysql_select_db($baza) or die ('Odabir baze nije uspio!');

for(
$a=1;$a<4;$a++){

if(isset(
$_POST['cb'.$a]))
{
$total =;
$amount $_POST['cb'.$a];
$total += $amount;
}
}
echo 
$total;



?>
So my basic idea is to loop through all checkboxes,see wich ones are set and add their values to $total.

But I get some strange behaviour,like if I check first and second it will display "355300".That means it's not adding values.If I check second and fourth then only the second value is displayed?
What am I doing wrong?