Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/450.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在php中访问java脚本变量值并插入数据库_Javascript_Php - Fatal编程技术网

Javascript 在php中访问java脚本变量值并插入数据库

Javascript 在php中访问java脚本变量值并插入数据库,javascript,php,Javascript,Php,这是我的javascript代码: var totalPrice=0; var x=parseInt(document.getElementById("amount").value)||0; var e = document.getElementById("currency"); var value = parseFloat(e.options[e.selectedIndex].value); var text = e.options[e.selectedInde

这是我的javascript代码:

var totalPrice=0;
    var x=parseInt(document.getElementById("amount").value)||0;
    var e = document.getElementById("currency");
    var value = parseFloat(e.options[e.selectedIndex].value);
    var text = e.options[e.selectedIndex].text;
    totalPrice=(x*value).toFixed(2);
    document.getElementById("totalPrice").innerHTML="<h3>Total Price : "+totalPrice+" "+text+"</h3>";
var totalPrice=0;
var x=parseInt(document.getElementById(“amount”).value)| 0;
var e=document.getElementById(“货币”);
var value=parseFloat(e.options[e.selectedIndex].value);
var text=e.options[e.selectedIndex].text;
总价=(x*值).toFixed(2);
document.getElementById(“totalPrice”).innerHTML=“总价:+totalPrice+”“+text+”;
这是我的html代码:

<div id="totalPrice" name="totalPrice"></div>


我想在php变量中访问此变量var total price value。

以何种方式?你在提交表格吗?您希望从PHP脚本中获得反馈吗?您是否了解表单提交和AJAX?请查看我的,它可能会解决您的疑问。