if ($_POST['operation_mc']){ $sum = $mc + $_POST['mc_u']; } else{ $sum = $mc - $_POST['mc_u']; } echo $sum;