Please see the
<?php
if($_POST['submit'])
{
$beg=$_POST['basic'];
}
if($_POST['inter'])
{
$int=$_POST['int'];
}
if($_POST['advance'])
{
$adv=$_POST['adv'];
}
?>
function refreshPrices() {
var beg=<?php echo $beg; ?>;
var inte=<?php echo $int; ?>;
var advn=<?php echo $adv; ?>;
var currentTotalValue = 0;
currentTotalValue = currentTotalValue + parseInt(beg) + parseInt(inte) + parseInt(advn);
$("#results div").each(function() {
if (!isNaN(parseInt($(this).find("span").text().substring(1)))) {
currentTotalValue += parseInt($(this).find("span").text().substring(1));
}
});
$("#totalValue").text("$" + currentTotalValue)
}
If I add one variable from php and add them to current total in jQuery function, it is working fine, but if I add 3 variables and them to jQuery total it is not working. In my html I have 3 buttons with different hidden values just to post them to second page what ever the value it will be added to jQuery total.
echo isset($beg) ? $beg : 0. And same for others. Check if it solves.