<?php
$num = 0;
foreach($_POST['t2'] as $value)
{
$num +=$value;
}
echo $num;
?>
<form name='ttt' action='test3.php' method='post'>
<input type='checkbox' name='t2[]' value='1'>
<input type='checkbox' name='t2[]' value='2'>
<input type='checkbox' name='t2[]' value='4'>
<input type='submit' value='submit'>
</form>
echo array_sum($_POST["cb"]);