<script language="javascript">
function emergency()
{
if(document.getElementById('emer').checked == true)
{
<?php $_SESSION['total2']= $_SESSION['total1'] + 50; ?>
document.getElementById('emr').innerHTML = "<b>Payable Amount: </b>" + <?php echo $_SESSION['total2']; ?>;
}
if(document.getElementById('emer').checked == false)
{
<?php $_SESSION['total2']= $_SESSION['total2'] - 50; ?>
document.getElementById('emr').innerHTML = "<b>Payable Amount: </b>" + <?php echo $_SESSION['total2']; ?>;
}
}
</script>
here I am adding $_SESSION['total1']+50
and put the value in new session SESSION['total2']
. The problem is that , when I echo this new $_SESSION['total2']
out side script,ie, in the page like
<?php echo $_SESSION['total2'];?>
it returns the value of $_SESSION['total1']).