I'm beginner to php. I wanted to get value when page loading using prompt box in php code.
Here is the code `
<?php function prompt($prompt_msg) {
echo("<script type='text/javascript'> var answer = prompt('".$prompt_msg."'); </script>");
$answer = "<script type='text/javascript'> document.write(answer); </script>";
return($answer);
}
//program
$prompt_msg = "Please Enter the Cash price.";
$price = prompt($prompt_msg);
echo $price ; ?>
It worked perfectly.But when i tried this equation ,$name value not active
` $balance="";
// Calculate balance
$p=(int)($price)+0;
$balance= $p - $sub_total;
echo $balance;
It always give negative value of $sub_tot,Because $float act as always 0,I used
this equation $balance= $price - $sub_total;,When i echo balance its also gave same output
Please give me solution